There are times, when you’re working on your WooCommerce powered site, that you are making changes that might have an impact on a customer if an order is placed at the same time. This is, presumably, one of the reasons WooCommerce added the ability to have a Demo Store notice on your site.
Okay, that’s great! BUT, my store isn’t a demo store and I don’t want any potential customers to think that it’s not a full fledged store. I might want to give them a notice that says something like “Hey – We’re making some changes that might impact ordering. When this message is gone, you can safely place your order”.
There is an easy, and rather elegant, way to accomplish this without digging into the WooCommerce core code.
At the top of your theme’s functions.php file simply place the following code:
if (!function_exists( 'woocommerce_demo_store' )) { function woocommerce_demo_store() { if (get_option( 'woocommerce_demo_store' )== 'no' ) return ; $message = '<p class="demo_store">' .__( 'Hey - We are making some changes that might impact ordering. When this message is gone, you can safely place your order.' , 'woocommerce' ). '</p>' ; echo apply_filters( 'woocommerce_demo_store' , $message ); } } |
That’s all there is to it! You can change the message to whatever you need to make your visitors aware.