Update products on stock after new WooCommerce orders
If you’re using WooCommerce for your e-commerce site, and you notice that products on stock don’t get correctly updated, you can use the little plugin below to clear WP Rocket’s cache every time a new order is completed.
Helper plugin:
Heads up! This plugin is intended for sites that use an instant form of payment, like credit cards. If your site accepts non-instant payment methods like bank transfer etc., you will need to edit the code before using it. See instructions below.
📥 Download (.zip): WP Rocket | Clean Post Cache after WooCommerce Order
Developers: you can find the code for this plugin on GitHub.
By default, the plugin above utilizes this WooCommerce hook:
woocommerce_payment_complete
If your site accepts non-instant payment methods, you will need to use a different hook in the last line of the code, such as this one:
woocommerce_order_status_on-hold