@ionutn I have a WooCommerce site that has a Shop (catalog) page and then Single Product pages. You can add to cart on a Single Product page, but you can also add any item to your cart on the Shop page. I have a PHP function in my child theme’s functions.php file that hooks into the ‘woocommerce_is_purchasable’ filter, and it returns false if it’s not currently business hours.
So when the shop closes for the day:
What currently happens is that the PHP code runs, online ordering is turned off, and so the “Add to cart” button disappears from the Single Product page but not from the Shop page. I’m assuming that the Single Product page is not cached by default in this plugin, but the Menu page’s HTML is cached and so it needs to be purged in order for the “Add to cart” buttons to disappear from the Shop page.
And then vice versa for when the shop opens for the day at 11 AM.
So far I’ve been manually purging the Shop page myself at 11 AM and 6 PM every day, but this is not scalable, especially since I’m a one-man team. It’s only been a week and I’m already tired of having to do this, to be honest. My last resort is not caching the Shop page at all, but the downside of that is that during business hours my page has lower performance (and a lower Google PageSpeed score) when it doesn’t need to…
I’m wondering: why is it not possible to purge a specific page on a schedule? When I manually purge a specific page, you guys are making a request to Cloudflare on your end, right? Can I not make that same request myself in my theme code, and then turn that into a cronjob? By the way, regarding my previous message in this thread, I’m also confused why I get a 401 Unauthorized error when I try running the “purge the whole cache” cronjob.