When you run a WooCommerce online store, sometimes you want to place a custom message or other content strategically on your shop.
Of course, there are many reasons you might want to place content specific parts of your store, from limited stock messages to updates on sales— and many other unique uses.
And if you can do this all of this with strategically placed messages, supplemented by conditional logic, well, you can imagine the possibilities. That is where the WooCommerce Conditional Content extension comes in.
Adding Unique Messages and Content to Your WooCommerce Online Store
You can create these messages with this extension by using what are called Content Blocks. You will find them under the WooCommerce menu in your dashboard.
Creating a Content Block
To add a content block, you will be taken to a custom post type where you can do several things.
Output Settings: Type and Location
You will have the option to have the content shown once or in a loop. You also have control over where you want the placement of the content or message. There are several options:
WooCommerce – this will place content before and after the main content on your shop page, category pages and single product page.
Shop – this adds content on your shop page, below your title and after the product listings.
Single Product – there are numerous places you can add content on a single product page.
Custom – this allows you to place it anywhere on your site using hooks and filters.
You can also create custom actions using hooks. In their documentation, they have a resource for hooks and filters. This gives you a lot more flexibility with placement. But when using the rules, any rule based on a single product, the hook will only show on the single product page.
Content / Message Creation
It’s easy to create custom content or messages using the familiar editor window, which gives you formatting control over the content.
Rules / Conditional Logic
This, of course, is where the real power lies: how and when this content shows up.
With any conditional logic or rules, it can be as simple or as complicated as needed. The first rule or rules are based on and. Each rule must be met. We can also add one or more or rules, so content will show not only when something and something else is set, but it will happen if something or something else is set.
If we look at all the variables you can use in rules, it is obvious that you can fine tune the control of when your content or messages display.
Just looking at this list, you can imagine the possibilities. Of course, it would be impossible to show every instance where this could be used. But here are a couple of examples:
On Sale, Stock Getting Low
Let’s say I have a sale on all microphones. But I also want to let customers know that I have limited stock and warn them when I get below five in stock. Though I do have the stock number showing, this lets my customers know that when they are gone, there are no more on sale—and it’s in a prominent spot that will catch their eyes and create urgency.
I would simply create my message and add these three rules as ongoing messages. I can make it bold, italicized and red so it stands out. In addition, I chose this for the single product page, after the product title:
Now if I look at a product that is below five remaining in stock, this is what I see:
But if I visit another microphone on sale that isn’t that low in stock, the message doesn’t show.
Free Shipping on Minimum Purchase
In this example, I am using a simple rule but also am using two separate messages, as I’m offering free shipping on total cart purchases of over $150. I create a second message to let them know they are getting free shipping once their cart has that amount in it.
On placement, I am adding it before the main content so it will show up on the shop page, archives and single product page.
We now find it on all the pages. For example, here it is on the shop page.
Once the cart exceeds $150 the message no longer shows.
Of course I could share a ton more examples, but you can get the idea here. With the variety of rules you have, and the placements, you can get very creative with the WooCommerce Conditional Content extension.