In today’s article we will add a small banner on the single product page which will urge our customers to complete their orders as quickly as possible to take advantage of same day shipping.
Install and activate a child theme
The first step on our process here is to create and install a child theme. If you are using one of our themes you can easily grab its child theme from our downloads section. If not, you can read our beginner’s guide on child themes to create your own. This step is essential in order to preserve our changes throughout theme updates.
Display the banner
To display our banner we will use the woocommerce_single_product_summary hook. By default WooCommerce has the product title, rating, price, excerpt, meta and sharing options hooked with priorities of 5, 10, 10(?), 20, 40 and 50 respectively. Let’s show our banner below the price and use a priority of 19.
Now we have a banner with our text which appears on all products below the price. Let’s take it a step further and say we want to let our customers know of a same day shipping possibility if they order before a certain time.
Our snippet above will output a message that urges our customers to order now in order to have the product shipped to them today. The snippet will only display the message if the store’s local time is before noon (12pm) and if it is not a Saturday or Sunday. You can have a look at PHP’s DateTime object format if you want to fiddle around with the $noon variable which returns a date object of the current day’s noon on the UTC timezone.
With this small snippet we can easily add a banner to all our products informing users of a service like the same day shipping in the example above, or a store wide offer and anything else we might want our customers to notice. With an easy modification on the dates we can set it to display a limited time offer and have it disappear once the offer period passes, without having to worry about removing it manually. Did you find this snippet useful? Let us know in the comments below.
I think i will have huge benefit if im using your theme since i can found many usefull content like this.
I want to build a listing website using ‘listee’ and have been consider to buy a package of your bundle.
But i will also have a feature for user to make an event listing, what event plugin best to include on listee theme to acommodate my goal ?
Any popular event management plugin for WordPress should do the trick. Listee only has some affects on WP Job Manager and WooCommerce due to the provided integration. Other plugins should work as expected. You could run into styling issues in some rare cases but our support can help you fix them.