-2

Is there a hook to change the default Woocommerce "Sale!" text to custom text, for a specific product category only, or for specific products only?

Erin M.
  • 9
  • 3
  • Please read : https://stackoverflow.com/help/dont-ask – bhanu May 29 '21 at 18:49
  • Does this answer your question? [Display the discount percentage on the sale badge in Woocommerce 3](https://stackoverflow.com/questions/52558950/display-the-discount-percentage-on-the-sale-badge-in-woocommerce-3) – bhanu May 30 '21 at 05:31

1 Answers1

0

Use custom PHP function with hooks

function new_sale_badge() {
      if( has_term( 'category_name', 'product_cat' ) ){
      return 'New_sale_text';
      }
    }
    
    add_filter('woocommerce_sale_flash', 'new_sale_badge');

Code goes in the functions.php file of the active child theme (or active theme).