Here’s yet another easy WooCommerce PHP snippet if you wish to completely remove / hide or translate / rename the SALE! badge on the homepage, shop page, category pages and single product pages.

Once again, with a few lines of code (and specifically, the “woocommerce_sale_flash” filter) you can achieve anything you want. Enjoy!

Remove SALE badge from WooCommerce Product Archive and Single Product Pages

PHP Snippet #1: Remove Sale! Label From Products – WooCommerce Shop & Single Product Pages

/**
 * @snippet       Remove SALE badge @ Product Archives and Single Product
 * @how-to        Get CustomizeWoo.com FREE
 * @author        Rodolfo Melogli
 * @compatible    Woo 4.1
 * @donate $9     https://businessbloomer.com/bloomer-armada/
 */
 
remove_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_show_product_loop_sale_flash', 10 );

remove_action( 'woocommerce_before_single_product_summary', 'woocommerce_show_product_sale_flash', 10 );

// ---------------
// IN ALTERNATIVE TO REMOVE_ACTIONS:

add_filter( 'woocommerce_sale_flash', '__return_null' );

PHP Snippet #2: Rename / Translate Sale! Label – WooCommerce Shop & Single Product Pages

/**
 * @snippet       Rename SALE badge @ Product Archives and Single Product
 * @how-to        Get CustomizeWoo.com FREE
 * @author        Rodolfo Melogli
 * @compatible    Woo 4.1
 * @donate $9     https://businessbloomer.com/bloomer-armada/
 */

add_filter( 'woocommerce_sale_flash', 'bbloomer_rename_sale_badge', 9999 );

function bbloomer_rename_sale_badge() {
   return '<span class="onsale">ON OFFER</span>';
}

// NOTE: PLEASE KEEP THE <SPAN> TAG

Is there a plugin for that?

If you’d love to code but don’t feel 100% confident with PHP, I decided to look for reliable plugins that achieve the same result. As usual, I’ve chosen WooCommerce plugin vendors based on marketplace reputation, dedicated support quality, code cleanliness, long-term reliability and – probably almost as importantly – where the “people behind” the plugin are active supporters of the WordPress ecosystem.

1. WooCustomizer

Sold by: WooCustomizer – Developed by: Zack Viljoen – 14 Day Money Back Guarantee

Editing the “SALE!” badge is one of the features of WooCustomizer, a plugin built for everyone who wants to fully customize their WooCommerce store without coding (e.g. edit buttons, badges, tabs, pages, stock display, checkout fields).

2. YITH WooCommerce Badge Management

Sold by: YITH – Developed by: YITH – 30 Day Money Back Guarantee

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.

Share:

Leave a Reply