Site logo

Archived topic

generate_footer Location in Elements not working on WooCommerce

26 replies · Started by Peter on July 19, 2021

Viewing posts 16–27 of 27

I have the host's caching turned off. The site has always had the element as a footer since day 1 so it should not have cached a version with the default footer. I tested both the live and staging site with 8 different search phrases and they have identical behaviour with only wood and pen showing the correct footer.
The problem also shows up on a bare bones localhost installation with WooCommerce, GB and GP Premium as the only plugins and using GeneratePress theme without the child activated. In this case pen shows the correct footer and wood does not.

Well its dumbfounded me as there are no conditions that would change based upon the search string.
As an alternative, what happens if you change the Hook to before_footer ? This will display it in the same place. You would just need to disable the Footer Bar

I've just tried it using before_footer and after_footer and both have the same problem as footer! Odd.

I am going ask Tom to take a look if thats ok - as i am out of ideas.

Hi David,

Yes, that's fine. Thanks for trying!

Interesting issue. Do any hooks work on the search results page? What if you add one above the header?

A bit of a shot in the dark but worth trying - can you try adding this filter?:

add_filter( 'generate_elements_custom_args', function( $args ) {
    $args['suppress_filters'] = true;

    return $args;
} );

I've checked, and there is a hook that should display on all pages but does not show on the product search pages. It uses generate_before_footer and displays a Free UK Postage - the price you see is the price you pay! message. This one does not work on all search terms including wood and pen on which the footer appears as it should.

I tried the filter in your post and it has fixed the problem! Thank you. Is it OK to use this on the live site?

Interesting - yes, you're good to use that on a live site. We'll look into why it's happening and will try to implement a permanent fix.

Thanks!

That's great. Thanks for sorting the problem.

No problem!

Hi Tom,

I noticed that the just released WooCommerce 5.5.2 had a changelog item that looked like it might relate to the problem:
Fix – Remove unnecessary seacrh related ‘where’ clause added in the ‘post_clauses’ hook handling. #30335

After upgrading to 5.5.2 I removed your fix from the functions.php and it worked OK. I also verified this on localhost by removing your fix, and checking that the error was present, before upgrading to 5.5.2 and it worked fine after the upgrade.

Great news - thanks for letting us know!

This archived topic is closed to new replies.