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-layout-start]
<!-- wpv-loop-start -->
<wpv-loop>
<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]
[/wpv-if]
[wpv-if price="_sale_price" evaluate="!empty($price)"]
<del>$[wpv-post-field name="_regular_price"]</del> $[wpv-post-field name="_sale_price"]
[/wpv-if]
[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]
[wpv-if price="_min_variation_price" evaluate="!empty($price)"]
From: $[wpv-post-field name="_min_variation_price"]
[/wpv-if]
</span>
[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>
[wpv-wooaddcart]
<div class="clear"></div></li>
</wpv-loop>
<!-- wpv-loop-end -->
[wpv-no-posts-found][wpml-string context="wpv-views"]<strong>No posts found</strong>[/wpml-string][/wpv-no-posts-found]
[wpv-layout-end]
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>
[/wpv-if]
Please let me know if there is anything else that I can assist you with.
Regards,
Caridad
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!