• Resolved rojasq

    (@rojasq)


    Hello,
    I am using the W3 Total Cache plugin for my Woocommerce store.
    When someone places an order, the stock is not automatically reduced by 1 on the product page – I have to go to the W3 Total Cache plugin settings and clear the cache each time.


    Is there a way to clear the cache after each order (or after any changes on the website)?

    I will be grateful for your help.
    Thank you

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @rojasq

    Thank you for reaching out and I am happy to help!

    The W3 Total Cache is purged once the content is updated in the backend, however, there are some things like a stock that are not triggering the purge.

    Try adding this to your functions.php:

    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();
    }

    Let me know if this helps!

    Thanks!

    Thread Starter rojasq

    (@rojasq)

    Thank you @vmarko ! It helped!

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Clear cache automatically after purchase’ is closed to new replies.