Skip Navigation

[Resolved] WooCommerce "Sale" field? Where is it?

This support ticket is created 10 years, 1 month ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 19:00 10:00 – 19:00 10:00 – 19:00 10:00 – 19:00 10:00 – 19:00 -
- - - - - - -

Supporter timezone: Europe/Madrid (GMT+01:00)


This topic contains 2 replies, has 2 voices.

Last updated by Jive 10 years, 1 month ago.

Assigned support staff: Caridad.


I have my WooCommerce shop somewhat close to completion. I'm struggling to find a way to put the "Sale" badge in my product View.

Is there a shortcode for just the on sale badge?

I've attached a screenshot of the demo page for Woo's Canvas theme (I'm using Genesis) to show you what i'm talking about. It's the little red, oval "Sale" badge for the products that are on sale.

My current View code is this, if it matters:

<!-- wpv-loop-start -->
<li class="product"><h3>[wpv-post-link]</h3>
	<span class="price">
	    [wpv-if price="_sale_price" evaluate="empty($price)"]
	    [wpv-if price="_min_variation_price" evaluate="empty($price)"]
	        $[wpv-post-field name="_price"]
	    [wpv-if price="_sale_price" evaluate="!empty($price)"]
		    <del>$[wpv-post-field name="_regular_price"]</del> $[wpv-post-field name="_sale_price"]
	    [wpv-if price="_min_variation_sale_price" evaluate="!empty($price)"]
		    From: <del>$[wpv-post-field name="_min_variation_regular_price"]</del> $[wpv-post-field name="_min_variation_sale_price"]
	    [wpv-if price="_min_variation_price" evaluate="!empty($price)"]
		    From: $[wpv-post-field name="_min_variation_price"]
	[wp_media media="audio" volume=0.8 urls="[types field="file"][/types]"]
	<span class="product-meta"><p><i class="icon-folder-close-alt"></i> [wpv-post-taxonomy type="product_cat" separator=", " format="link" show="name"]</p><p><i class="icon-headphones"></i> [wpv-post-taxonomy type="producers" separator=", " format="link" show="name"]</p></span>
<div class="clear"></div></li>
<!-- wpv-loop-end -->
[wpv-no-posts-found][wpml-string context="wpv-views"]<strong>No posts found</strong>[/wpml-string][/wpv-no-posts-found]

This code is working perfectly for the way I want my shop to look, the only thing missing on the product archives is the Sale badge.


Dear Jive,

You can evaluate if the sale price is not empty and show the badge in its proper location:

[wpv-if sale="_sale_price" evaluate="!empty($sale)"]
<span class="onsale">Sale!</span>

Please let me know if there is anything else that I can assist you with.



I'm embarrassed at how obvious that was. I forgot the sale badge was just a simple span class, I was thinking it was more functionality and required it's own dedicated shortcode.
Thank you!