• Resolved Lyk

    (@lyk-1)


    Hello,

    When one changes the stock of a variation and clicks the “Save changes” in the WooCommerce Variations tab, then the product cache is not flushed.
    If the main post/product “Update” button is clicked, then the cache is flushed and the change appears in the frontend.

    It seems that this is quite an old issue, e.g. here and here and there are some proposed solutions, like flushing everything:


    add_action( 'woocommerce_product_set_stock', 'w3tc_flush_all_custom', 999 );
    add_action( 'woocommerce_variation_set_stock', 'w3tc_flush_all_custom', 999 );

    function w3tc_flush_all_custom() {
    w3tc_flush_all();
    }

    Or even better, fine tune it, in order to only flush the specific product.

    How is this still an issue? It seems a pretty basic bug, for it to be alive for such a long time.


    Any plans of getting it fixed in next versions?

    Thank you and keep up the good work!

    • This topic was modified 5 months ago by Lyk.
Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @lyk-1

    Thank you for reaching out and I am happy to help!
    At the moment, the solution you mentioned is the only solution at the moment to remedy this.
    We are working on this and in the upcoming releases, you can expect a feature that will focus on these types of problems when a single purge is needed for a product or a page.

    Thanks!

    Thread Starter Lyk

    (@lyk-1)

    Ok, thank you for letting us know!

    Is the mentioned solution the only one?
    Or someone can also just use something like w3tc_pgcache_flush_post($post_id); in order to flush only the one product with the change?

    Moreover, do we have any rough timeline on these releases? (Since the issue seems to be active for more than 1 year)

    Thank you!

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @lyk-1

    Currently, this is the only option.
    You can use ($post_id) however, you need to way to specify and trigger this for the specific post. In the solution that we are working on, once for example the stock changes, the cache will be flushed for that specific product, and all the pages that the product is on

    Thanks!

    Thread Starter Lyk

    (@lyk-1)

    I see, that seems proper.

    The function w3tc_pgcache_flush_post is valid and provided from the plugin, correct?

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @lyk-1

    Sorry to the late reply. You can use w3tc_flush_post( $post_id) instead.

    Thanks!

    Thread Starter Lyk

    (@lyk-1)

    Ok, thanks for letting me know!

Viewing 6 replies - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.