• Resolved cnlselectronics

    (@cnlselectronics)


    Hello,

    We have been using the imports with your plugin for over a year now and works great! We have recently implemented Litespeed Cache to improve a number of things and they do purge product cache automatically if the standard woocommerce hooks are activated to update stock.

    However, this doesnt seem to be happening as the products are out of sync until we purge cache manually. They have asked for us to add the below snippet. But is there a way that we can add this to functions to happen when your plugin updates stock? or maybe we can add to the plugin directly if thats the only option. Thanks

    do_action( 'litespeed_purge_post', $product_id );
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support rzepsen

    (@rzepsen)

    Hi @cnlselectronics

    Thank you for contacting us. Have you added this code to the functions.php file of the theme you are using in your shop? Does the problem still occur? What do you mean by saying that the products are out of sync?

    Thread Starter cnlselectronics

    (@cnlselectronics)

    Hi,

    I havent added the above code no, I think it needs to be part of the function of when your plugin updates stock so when the stock update process is complete, this do action can be added to run at the end? I suspect thats what they meant as it makes most sense. Im not sure how I can add this to functions to run after your plugin has updated stock though.

    What i mean by stock out of sync is. The backend shows the correct value but the customer facing website shows “100 in stock”. When you add it to basket it errors and says there is no stock to add to the basket. Because the real value is 0, just the cache is still showing 100. This is an option in Litespeed to clear the product/category cache after a product is saved. But only if the stock is updated using the regular Woocommerce hooks. When I reached out to them, they suggested to added the above code i sent to end of your code so once your plugin updates/saves our products stock, it will then run the purge cache for that product.

    I just dont know how your plugin updates, or where I can add this so that its run after you update our product

    Plugin Support rzepsen

    (@rzepsen)

    Hi @cnlselectronics

    Oh, I see. The Dropshipping plugin uses WooCommerce methods to update stock. You can hook into the filter:
    woocommerce_updated_product_stock and perform cache-cleaning actions there.

    Plugin Support rzepsen

    (@rzepsen)

    Hi @cnlselectronics

    As we haven’t got any replies, I’m marking this topic as resolved for now.

    Feel free to contact me.

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

The topic ‘Cache/Update’ is closed to new replies.