Title: Cache/Update
Last modified: January 26, 2025

---

# Cache/Update

 *  Resolved [cnlselectronics](https://wordpress.org/support/users/cnlselectronics/)
 * (@cnlselectronics)
 * [1 year, 6 months ago](https://wordpress.org/support/topic/cache-update-3/)
 * 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
 *     ```wp-block-code
       do_action( 'litespeed_purge_post', $product_id );
       ```
   

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

 *  Plugin Support [rzepsen](https://wordpress.org/support/users/rzepsen/)
 * (@rzepsen)
 * [1 year, 6 months ago](https://wordpress.org/support/topic/cache-update-3/#post-18267269)
 * Hi [@cnlselectronics](https://wordpress.org/support/users/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](https://wordpress.org/support/users/cnlselectronics/)
 * (@cnlselectronics)
 * [1 year, 6 months ago](https://wordpress.org/support/topic/cache-update-3/#post-18267283)
 * 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](https://wordpress.org/support/users/rzepsen/)
 * (@rzepsen)
 * [1 year, 6 months ago](https://wordpress.org/support/topic/cache-update-3/#post-18269701)
 * Hi [@cnlselectronics](https://wordpress.org/support/users/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](https://wordpress.org/support/users/rzepsen/)
 * (@rzepsen)
 * [1 year, 6 months ago](https://wordpress.org/support/topic/cache-update-3/#post-18284168)
 * Hi [@cnlselectronics](https://wordpress.org/support/users/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.

 * ![](https://ps.w.org/dropshipping-xml-for-woocommerce/assets/icon-256x256.png?
   rev=2621309)
 * [Dropshipping XML for WooCommerce](https://wordpress.org/plugins/dropshipping-xml-for-woocommerce/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/dropshipping-xml-for-woocommerce/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/dropshipping-xml-for-woocommerce/)
 * [Active Topics](https://wordpress.org/support/plugin/dropshipping-xml-for-woocommerce/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/dropshipping-xml-for-woocommerce/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/dropshipping-xml-for-woocommerce/reviews/)

 * 4 replies
 * 2 participants
 * Last reply from: [rzepsen](https://wordpress.org/support/users/rzepsen/)
 * Last activity: [1 year, 6 months ago](https://wordpress.org/support/topic/cache-update-3/#post-18284168)
 * Status: resolved