WooCommerce: Add Text Under Each Product @ Shop Page
A client asked me to add a “Free Shipping” notice under each WooCommerce product on the Shop Page. This can increase your click-through rate and hence your sales conversion rate. Here are a couple of PHP and CSS snippets so that you can implement this helpful edit.
PHP snippet: show “Free Shipping” under each product @ WooCommerce Shop
“I don’t code – is there a reliable plugin for that?”
As many readers would love to code but don’t feel 100% confident with it, I decided to look for a reliable plugin that achieves the same (or even better) result.
In this case, I recommend the YITH WooCommerce Badge Management plugin. On top of displaying custom text badges (free version), you can also create CSS, image and advanced badges, assign product badges to specific products and/or categories, pick the badge position and much more.
You can place PHP snippets at the bottom of your child theme functions.php file (delete "?>" if you have it there). CSS, on the other hand, goes in your child theme style.css file. Make sure you know what you are doing when editing such files - if you need more guidance, please take a look at my free video tutorial "Where to Place WooCommerce Customization?"
Does this snippet (still) work?
Please let me know in the comments if everything worked as expected. I would be happy to revise the snippet if you report otherwise (please provide screenshots). I have tested this code with Storefront theme, the WooCommerce version listed above and a WordPress-friendly hosting on PHP 7.3.
Check out these free video tutorials. You can learn how to customize WooCommerce without unnecessary plugins, how to properly configure the WooCommerce plugin settings and even how to master WooCommerce troubleshooting in case of a bug!
Business Bloomer Founder
Author, WooCommerce expert and WordCamp speaker, Rodolfo has worked as an independent WooCommerce freelancer since 2011. His goal is to help entrepreneurs and developers overcome their WooCommerce nightmares. Rodolfo loves travelling, chasing tennis & soccer balls and, of course, wood fired oven pizza.
59 thoughts on “WooCommerce: Add Text Under Each Product @ Shop Page”
I have question, I would like to ask if it is possible to pass custom value to a hook ? I have plugin where I manipulate with price and after I get result I would like to write a text under variations not directly under price.
As I found on you website site I could use hook name: woocommerce_after_shop_loop_item
I didn’t found an option to call a hook and pass custom text is that possbile ?
Thank you in advance.
Hi Aljaz, thanks so much for your comment! Yes, this is definitely possible, but I’m afraid it’s custom work. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding!
Yeah this applies to all products, but a reasonable thing to mention would be a conditional if this only should apply to products that actually have a free shipping class.
Thanks for your solution Yoyo!
Hi, i was wondering if its also possible to add a custom text ( “Coming soon” ) ,to the products from a specific category, below the price on the shop/archive pages? Hope to hear!
Hi Jasper, thanks so much for your comment! Yes, this is definitely possible, but I’m afraid it’s custom work. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding!
Can I use the same thing, If i would like to add text on the default shop page at the bottom after all products?
Almost – you just need to change hook: https://www.businessbloomer.com/woocommerce-visual-hook-guide-archiveshopcat-page/
Is it possible to add text to only the “SALE” products?
Tried this but it’s for all products.
Hello Zeian, thanks so much for your comment! Yes, this is definitely possible, but I’m afraid it’s custom work. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding!
Thank you for all your Woocommerce customization articles – you are a lifesaver! Thank you thank you!!
What about if I wanna ad costom text on specific products only.
You’d look into conditional logic https://www.businessbloomer.com/woocommerce-conditional-logic-ultimate-php-guide/
Dear…I am using woo commerce and I want to remove category labelled before (woocommerce_before_shop_loop_item_title) on the product page. I used many snippets but neither works…Hope, you have the answer for the same. Thanks in advance…and always loved your PHP snippets that helped me a lot…
Hi Asif, thanks so much for your comment! Yes, this is definitely possible, but I’m afraid it’s custom work. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding!
Amazing post! For readers who want to show ‘Free shipping’ on some products, but weren’t able to pull it off using conditional logic, I found “Product Subtitle” plugin to be quite useful.
Customizing the plugin with some tips from here https://businessbloomer.com/woocommerce-add-icon-add-cart-buttons/ gave an amazing result. (It was a bit tricky, but trust me, anyone can find their way around it.)
Thanks alot Rodolfo,
I really appreciate your good article! But how about changing ‘Free shipping’ to ‘read more’, and connect it to product page when clicking it?
Hey there, thanks so much for your comment! Yes, this is possible – but unfortunately this is custom work and I cannot provide a complementary solution here via the blog comments. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding! ~R
Can you help me with right snippet for showing “free shipping” text on category pages but for specific products only? Thanks
Hi Krecko – thanks so much for your comment! I suggest you take a look at “conditional logic”: https://businessbloomer.com/conditional-logic-woocommerce-tutorial/ and https://businessbloomer.com/woocommerce-conditional-logic-ultimate-php-guide/. Let me know 🙂
Hi, how do I go about changing the alignment? Right now it sits on the left hand bottom corner but I need it to be centered. Thanks!
Hey Farah, thanks for your comment! You’ll need a bit of CSS for that 🙂
Thanks for your snippets, it’s very usefull.
I want to add text only for variable products. How can I change this snippet for my issue?
Hey Mike, thanks for your comment! I suggest you take a look at “conditional logic”: https://businessbloomer.com/conditional-logic-woocommerce-tutorial/ and https://businessbloomer.com/woocommerce-conditional-logic-ultimate-php-guide/. Let me know 🙂
I try to do this:
But its wrong 🙁
Function name does not match 🙂
I want this too, what is the correct code then?
Hi Tuutje the whole code is correct, just the function name must match inside the hook trigger and the function declaration
I’m one of your fans in terms of how you neatly work on woocommerce. You’ve mastered the art of how to make things sound and look easy. Recently, I’ve also learned about creating widgets. I think setting up widgets for these customizations will be of great value. I just thought, I might be able to help in return with this. Because if a widget is setup, choosing specific products and editing will be a lot comvenient and safe. It will also save woocommerce users a lot of time, like 20x more. 🙂
Thanks for that Henry 🙂
I have used you snippet but I want to integrate it with the a Custom field plugin
I have a custom field “forfatter_key” that is retrieved with: wccf_print_product_prop_value()
How is that integrated into your snippet?
Hey Laurits, thanks so much for your comment! Yes, this is possible – but unfortunately this is custom work and I cannot provide a complementary solution here via the blog comments. Thanks a lot for your understanding! ~R
Possible to show the free shipping only if the product price is above the shipping threshold?
like free delivery for product above $20?
Hey Allan, thanks for your comment! I suggest you take a look at “conditional logic”: https://businessbloomer.com/conditional-logic-woocommerce-tutorial/ and https://businessbloomer.com/woocommerce-conditional-logic-ultimate-php-guide/. Let me know 🙂
Is it possible to have the text after the price but keep it in the loop item? I need the text to also link to the item page, thanks
Hey Pete, thanks for your comment! Yes, of course, you just need to change “hook”. I recommend studying this guide: https://businessbloomer.com/woocommerce-visual-hook-guide-archiveshopcat-page/
I want to print message free shipping in my shop page in condition wise like if mobile category so print free shipping other category then i don’t want to print free shipping and print this is not free shipping like…
Hey Meet, thanks for your comment! This resource should help: https://businessbloomer.com/woocommerce-conditional-logic-ultimate-php-guide/. Let me know
I just found your website on a random search.. Thanks for sharing your knowledge… I am using the php snippet to show per carton text underneath each product on the home page of a site… It works like a charm!!
Now my client has added a new product..
And for that individual product they need to have the “per carton” text removed..the product category is “soy-wax-candles”.. I tried excluding the new product by product id without any luck..
I am new to php, but willing to learn.. Just need a nudge on the right direction..
Any help that you can offer would be great!
Signed-up for you news letter!
Mike thank you so much for the feedback – much appreciated! Can you let me know what you did when you “tried excluding the new product by product id without any luck”? That would possibly help me help you 🙂
Thanks for illustrating use of the hook but don’t use id=”loopfree” in the loop as it will create multiple instances of the same id.
Hey Bobster thanks a million for your very helpful comment! I just updated the snippet and changed that from id to class. Much appreciated 🙂
You can have the message call for price on the store page in products where the price is empty ?
Hey Hugo thanks for your comment! Yes, this is custom but you can check if price is empty and return a custom message 🙂
is it possible to add an additional line just after(below) the product title on the category pages? So not underneath the price but between product title and price? I know how to add the product_excerpt there, but I don’t want the product excerpt, just one small additional line. Thanks!
Hello Andrea, thanks for your message! Of course it is possible. I used “woocommerce_after_shop_loop_item” hook, but there are more hooks you cna use to target the exact position you wish to place your text. Try using “woocommerce_after_shop_loop_item_title” 🙂
Many thanks for these high quality yet simple code snippets for woocommerce. i want to put KG/peace after the “quantity box”. is that possible, if yes then how?
Thanks in advance
Thanks for the feedback! To add the weight, try this:
is possible this? only show the message (free shipping) if the amount is more than certain price ? (sorry my english)
Hello Martin, thanks for your reply – check this article: https://businessbloomer.com/woocommerce-add-need-spend-x-get-free-shipping-cart-page – it works in a similar way than the one you’re asking. Hope this helps!
Thank you for this code. Is it possible to add a custom message under a specific product. Some of my products will have freight cost sice they are heavy.
Johannes, thank you for your enquiry! Yes, of course, it is possible to do absolutely everything 🙂
You will need some more advanced PHP that controls if the product weight is above “XYZ”, and only then prints the extra message.
It’s a bit advanced. You can check the product weight with this: $weight = woocommerce_get_product_terms($product->id, ‘pa_weight’, ‘names’)
Hope this helps!
FYI, I never received you follow-up comments notification email (3 posts).
I had made it worked in parent category. Need you light here.
1. I had 41 subcategory (incl. 1 parent category – Books) how is the conditional tags like? have to key-in all “slug”? Any conditional tag 1parent category apply to all subcategory?
2. I google-ing the conditional tag for apply all “product” to “shop page” and category (& subcategory) for specific category (with the answer point 1.0). Any guide?
The conditional tag is_product_category(‘slug’) works with main and sub categories no problem. In case you have multiple categories to target, you can use is_product_category( array( ‘slug1’, ‘slug2’ ))
Hope this helps!
Useful resources. Same question I asked before, Can I use WC conditional tag to wrap your snippets for specific product category, especially root-category (included all subcategory).
Almost complete read all your WooCommerce Tips. Genius!
Subscribed your newsletters.
Thanks in advance
Of course! When you trigger the function, you can use something like this:
if ( is_product_category( ‘shirts’ ) )