Forums Forums Search & Filter Pro Cache not updating – best solution?

Tagged: 

Viewing 3 posts - 1 through 3 (of 3 total)
  • Anonymous
    #41024

    Hi there —

    Currently running S&FP on a site running woocommerce, using a form where it filters between in stock and out of stock items. The problem is, the cache is getting out of sync, and it’s displaying weird results.

    It seems like the cache should be updated every time a product stock changes, but clearly isn’t the case, so it looks like I need to do it myself.

    I see this function: do_action(‘search_filter_update_post_cache’, 23);

    So it seems like the only option I have is after checkout, to get the product that was just ordered and add that action with the appropriate id.

    Is that correct? Is there a simpler way of doing this? How often does the cache update on its own?

    Thank you!

    Ross Moderator
    #41025

    Hi Johnny

    You’re right on that approach.

    Everytime data is updated for a post this must be run.

    The cache has always run on the WP filter save_post which is fired when almost anything happens to a post, whether it deleted or updated etc…

    However it seems this is not happening when there is a sale, so save_post is not called – perhaps an WooCommerce update changed the way this works if it was working previously.

    Anyway, I like to support WooCommerce, so if you can dig out the right action/filter to grab the post ID after a sale is made, I will include that in S&F itself.

    Thanks

    Anonymous
    #41027

    Hi Ross —

    That’s great, thank you – yes, I’ll get this working and get back to you. I’m not sure if it was working previously, it’s for a contest site that is functional only about 3 weeks a year, and last year was the 1.X version without the cache.

    It’s particularly noticeable though on this site because there’s about 120 products and they have a quantity of 1, so the stock changes happens much more frequently than on a normal e-commence site.

    I’ll report back… thanks again!

    best,
    john.

Viewing 3 posts - 1 through 3 (of 3 total)