Refreshing custom pages when a product is modified
-
I’m using WP Super Cache on my WooCommerce site and it seems to be working quite well out of the box. Thanks to everybody involved!
For example, when I edit a product (or even just change the stock level of a variable product) that product page cache is correctly reset, as well as the categories the product is in and the homepage. Makes perfect sense.
Now, I have two custom pages, listing the newly added products as well as the currently discounted products, using product blocks. These pages cache is not reset when a product is modified, which is how the plugin is designed to work. However, it would be nice to be able to reset these pages cache automatically. Of course, one solution would be to disable caching for these pages but that defeats the purpose of the plugin.
Does anybody could share a snippet of code that would hook into the plugin logic that gets activated when a product is modified, and add the command to refresh a particular page? That way caching could be left enabled for that particular page, keeping its benefits, but getting cleaned up properly when, say, a new product is added to the site.
- The topic ‘Refreshing custom pages when a product is modified’ is closed to new replies.