Posted on 1 Comment

Change StoreWide Text Notice in WooCommerce

Why you should stop using knock off WooCommerce Plugins

If any one else is wondering how to:

Change StoreWide Text Notice in WooCommerce

so that you can add some html ~ like a sale or something else specific ~ here ‘ya go.

***A few real-life applications are towards the end of the post***

The StoreWide Text notice in WooCommerce is nice.  It’s already got all the CSS markup needed to act as a ‘Hello Bar’ type-of solution, and a nice spot in the admin area to easily change the text.

storewide notice text in woocommerce
storewide notice text in woocommerce

Since it’s already baked into WooCommerce, instead of adding (yet another) plugin, let’s use the storewide text notification.

It’s located in wp-content/plugins/woocommerce/includes/wc-template-functions.php

Get there via FTP or via Plugins>Editor…

storewide notice text in woocommerce
First Click ‘Plugins’, then ‘Editor’

…then select WooCommerce via the dropdown and click ‘Select’…

storewide notice text in woocommerce
Then select ‘WooCommerce’ in the dropdown box.

…then look for this line.

storewide notice text in woocommerce
Then scroll down a bit ’till you see this.

If you do a control + F and look for “woocommerce_demo_store” you’ll find it a bit faster.

We’ve changed that line a bit, so if you’re wanting to copy & paste the whole thing, here ya go.

Now, see where it says “https://myawesomewebsite/my-incredible-page” in the image above, & where it has the obvious satire Facebook post link in the gist? You’re going to want to change that url to whatever you want it to go to.

For Example, if you’re having a great sale on something in particular and you really want people to see that specific category / page / product, simply put that url where it says “https://myawesomewebsite/my-incredible-page

For the folks wanting to know how that was done, all we did was add a period + single quote + the html markup for a link (the href part) before the $notice, and then closed it out with another period + single quote + then closed the a href.

Open the comments on the gist by clicking this sentence to see the original and then the modified.

The end-result is that the storewide notice in WooCommerce will now act as a sitewide ‘Hello Bar’ (or whatever y’all call them things)!

When would you want to do this?

Let’s say you’re migrating from a Shopify platform to WooCommerce and you’ve got the whole store in ‘catalog’ mode, now you can use the storewide text notification to link out to the shopify page.

Perhaps you’ve got another store on Amazon, Ebay, or anywhere else and you’d like to have a sitewide notification to that store on Ebay or Amazon.  Now you can do it while you’re setting up your WooCommerce store.

Maybe you’ve downloaded one of those other notification bars and you’ve seen that it overlaps the storewide notification in WooCommerce? Now you can use the one that’s already baked into Woo!

Easy, right?

1 thought on “Change StoreWide Text Notice in WooCommerce

Leave a Reply to 컴온 come on Cancel reply

Your email address will not be published. Required fields are marked *