Exclude WooCommerce notice from cache




Wordpress LScache Plugin: Exclude WooCommerce notice from cache

Last Updated on: Wed, 15 Apr 2026 00:00:02
Is it possible to exclude WooCommerce notices from the cache? The notice appears in store pages automatically when the cafe is closed and purchases are disabled. Then the notice is removed the next day when the cafe is open. Here is the snippet adding the notice: add_action( template_redirect, closing_shop_notice ) function closing_shop_notice() if ( ! ( is_cart() || is_checkout() ) && ! is_store_open() ) wc_clear_notices() wc_add_notice( __( Diem?el esam slegti? Pasutijumus pienemam no otrdienas lidz ceturtdienai no 12:00-20:00 un piektdien, sestdien no 12:00-21:00 ), notice ) The page I need help with: https://koalafood.lv/edienkarte/ HI, try fire a purge all action when you change the notice on your 12:00 and 20:00/21:00 do_action( litespeed_purge_all ) Best regards, Thank you for your answer. I will test this out. Please dont close the thread yet. This did not work. Or maybe I am doing it wrong. Decided to remove this message from the shop pages entirely and leave it only in cart or checkout. These two pages are not cached, as I understand. Can you please explain how exactly I can add this action to execute on specific days and time. I am using Code Snippets plugin, so the code is executed on every page request, and this is not what is intended. I have set up 3 cron jobs on the hosting to execute a php file with your code in it. Will only this code be enough to run it or I need some kind of wrapper for it?



LiteCache Rush: Speed comes from using less, not from doing it faster



Reference