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?
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
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.
Hi @cnlselectronics
As we haven’t got any replies, I’m marking this topic as resolved for now.
Feel free to contact me.