cachingwoocommercelitespeed

How to adjust litespeed cache on woocommerce product update?


Currently I'm using litespeed on woocommerce and everything's goes up to the time of updating one single products, I want to update my single products without purging other products cache, just shop-page and updated product purge is ok. Please guide...


Solution

  • add_action('woocommerce_update_product', 'lscwp_suppress_purge_product_update', 10, 2);
    function lscwp_suppress_purge_product_update($product_id, $product) {
      ob_start( function($buffer) use ($product_id) {
        @header("X-LiteSpeed-Purge: " . LSWCP_TAG_PREFIX . "_Po." . $product_id . "," . LSWCP_TAG_PREFIX . "_WC_S");
        return $buffer;
      } );
    }
    

    try this , it will override the purge header upon product edit (by woocommerce_update_product )and then call purge to product page itself by $product_id , and shop page