Title: WooCommerce Smart Sale Badge
Author: Hugh Lashbrooke
Published: <strong>May 10, 2013</strong>
Last modified: December 5, 2018

---

Search plugins

![](https://s.w.org/plugins/geopattern-icon/woocommerce-smart-sale-badge_4c0066.
svg)

# woocommerce-smart-sale-badge

 * [Details](https://wordpress.org/plugins/woocommerce-smart-sale-badge/#description)
 * [Reviews](https://wordpress.org/plugins/woocommerce-smart-sale-badge/#reviews)
 * [Development](https://wordpress.org/plugins/woocommerce-smart-sale-badge/#developers)

 [Support](https://wordpress.org/support/plugin/woocommerce-smart-sale-badge/)

## Description

This plugin has been closed as of October 11, 2024 and is not available for download.
This closure is permanent. Reason: Author Request.

## Reviews

![](https://secure.gravatar.com/avatar/53bf89724049d063397136605865b18c1c706003a6d5f1fc63ccbb6206f75d06?
s=60&d=retro&r=g)

### 󠀁[very good](https://wordpress.org/support/topic/very-good-1908/)󠁿

 [Anonymous User 16103310](https://profiles.wordpress.org/anonymized-16103310/) 
June 2, 2018

Exactly what I was looking for. Was scared that it hasn't been updated in a moment
but works just fine

![](https://secure.gravatar.com/avatar/da03a901b70d27683d8344b2b7f38a90fd6a2c38985d19f35655363e9a491170?
s=60&d=retro&r=g)

### 󠀁[sales badge in percent](https://wordpress.org/support/topic/sales-badge-in-percent/)󠁿

 [tinto_brass](https://profiles.wordpress.org/tinto_brass/) September 3, 2016 1 
reply

this plugin is great! i made small mod to show sale in percent: <?php if ( ! defined('
ABSPATH' ) ) exit; class WooCommerce_Smart_Sale_Badge { private $dir; private $file;
public function __construct( $file ) { $this->dir = dirname( $file ); $this->file
= $file; // Handle localisation $this->load_plugin_textdomain(); add_action( 'init',
array( &$this, 'load_localisation' ), 0 ); add_filter( 'woocommerce_sale_flash',
array( &$this, 'badge_sale_amount' ), 10, 3 ); } public function badge_sale_amount(
$message, $post, $product ) { $saving_amount = 0; if ( $product->has_child() ) {//
Loop through children if this is a variable product foreach ( $product->get_children()
as $child_id ) { $regular_price = get_post_meta( $child_id, '_regular_price', true);
$sale_price = get_post_meta( $child_id, '_sale_price', true ); if( $regular_price!
= '' && $sale_price != '' && $regular_price > $sale_price ) { $new_saving_amount
= $regular_price – $sale_price; // Only display the largest saving amount if( $new_saving_amount
> $saving_amount ) { $saving_amount = $new_saving_amount; } } } $button_text = apply_filters("
wc_smart_sale_badge_title", __( 'Do', 'wc_smart_sale_badge' ), $product->has_child(),
$product); } else { // Fetch prices for simple products $regular_price = get_post_meta(
$post->ID, '_regular_price', true ); $sale_price = get_post_meta( $post->ID, '_sale_price',
true ); if( $regular_price != '' && $sale_price != '' && $regular_price > $sale_price){
$saving_amount = $regular_price – $sale_price; } $button_text = apply_filters("wc_smart_sale_badge_title",
__( '', 'wc_smart_sale_badge' ), $product->has_child(), $product); } // Only modify
badge if saving amount is larger than 0 if( $saving_amount > 0 ) { $saving_price
= woocommerce_price( $saving_amount ); $percentage = round( ( ( $product->regular_price–
$product->sale_price ) / $product->regular_price ) * 100 ); $saving_price_r = apply_filters("
wc_smart_sale_badge_price", sprintf( __( ' %s!', 'wc_smart_sale_badge' ), $saving_price),
$saving_price, $product); $message = '<span class="onsale">' . $button_text .'-'.
$percentage .'%'. '</span>'; } return $message; } public function load_localisation(){
load_plugin_textdomain( 'wc_smart_sale_badge' , false , dirname( plugin_basename(
$this->file ) ) . '/lang/' ); } public function load_plugin_textdomain() { $domain
= 'wc_smart_sale_badge'; $locale = apply_filters( 'plugin_locale' , get_locale(),
$domain ); load_textdomain( $domain , WP_LANG_DIR . '/' . $domain . '/' . $domain.'-'.
$locale . '.mo' ); load_plugin_textdomain( $domain , FALSE , dirname( plugin_basename(
$this->file ) ) . '/lang/' ); } }

 [ Read all 6 reviews ](https://wordpress.org/support/plugin/woocommerce-smart-sale-badge/reviews/)

## Contributors & Developers

“WooCommerce Smart Sale Badge” is open source software. The following people have
contributed to this plugin.

Contributors

 *   [ Hugh Lashbrooke ](https://profiles.wordpress.org/hlashbrooke/)

[Translate “WooCommerce Smart Sale Badge” into your language.](https://translate.wordpress.org/projects/wp-plugins/woocommerce-smart-sale-badge)

### Interested in development?

[Browse the code](https://plugins.trac.wordpress.org/browser/woocommerce-smart-sale-badge/),
check out the [SVN repository](https://plugins.svn.wordpress.org/woocommerce-smart-sale-badge/),
or subscribe to the [development log](https://plugins.trac.wordpress.org/log/woocommerce-smart-sale-badge/)
by [RSS](https://plugins.trac.wordpress.org/log/woocommerce-smart-sale-badge/?limit=100&mode=stop_on_copy&format=rss).

## Meta

 *  Version **1.1**
 *  Last updated **8 years ago**
 *  Active installations **N/A**
 *  WordPress version ** 4.0 or higher **
 *  Tested up to **5.0.30**
 *  [Advanced View](https://wordpress.org/plugins/woocommerce-smart-sale-badge/advanced/)