Last Updated on
Running a real e-commerce store often requires more than the default product layout. Every business is different and it needs to speak to make the important information visible to its clients.
There is no better place to add a small disclaimer, than the area under the “Add to cart” button on your product pages.
You can also add an image with trusted payment logos, or whatever you find important to your customers.
Any shortcode will work! So get creative.
But how to do that quick, for all the products in the store, with the option to change it easily in the future?
Using FREE Shortcodes
First in a draft post or page, create your note box, using the shortcode you like and styling it the way you like it. You can also use an image or just plain text.
For my example, I’m using the following shortcode, generated from Olevmedia Shortcodes plugin.
My final shortcode look like this:
Once you are happy with your note. You can go to the next step, which is adding the shortcode to your theme’s layout.
Creating Your Own Shortcode with Shortcoder
To make this functional as much as possible and easy to edit it in the future. Download the Shortcoder free plugin and install it.
Then just go to the plugin settings page (Settings > Shortcoder), create a new shortcode and paste your shortcode (the one we did above). Give your new shortcode a name and save it. Then grab the shortcode’s code and head to the next step.
(I know I said ‘shortcode’ too many times in this paragraph – shortcodeception)
Adding the Content to Your functions.php file
Find your child theme’s functions.php file and add the following code at the bottom.
add_action( 'woocommerce_after_add_to_cart_button', 'html_after_add_to_cart' );
<?php echo do_shortcode(' [sc name="below_cart"] </body></html>
Change [sc name="below_cart"] with your Shortcoder shortcode.
You are ready to see what you have achieved!
It is possible to play with the CSS to position it nicely below the button, add some paddings etc.
Using WP Bakery Page Builder Static Block and Massive Add-ons
If your theme supports static blocks, create a new one and place a row with “Alert” element.
If you’d like, you can add more elements like a countdown or any other Massive add-ons element of your choice.
Save your static block and copy the generated shortcode to the code we added in the functions.php file.
Enjoy and always back up your files in case this code is not supported by your theme!
Latest posts by Bozh (see all)
- How to Choose the Right WordPress Hosting in 2020 (Shared, VPS, Cloud) - January 26, 2020
- The Easiest way to Clone a WordPress Site (Forget Duplicator Plugin) - November 19, 2019
- Freebies Website with WordPress (Best Themes and Practices) - October 30, 2019