Purge the cache when the stock is updated in products in WooCommerce when using W3 Total Cache

Purge the cache when the stock is updated in products in WooCommerce when using W3 Total Cache on child sites.

Snippet Type

Execute on Child Sites

Snippet

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

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.