• Hi,
    how can I change the sale badge? It says “ANGEB” now, cause use the german wordpress version, but I would like it to be displayed as “SALE”. Is it possible to change the colour of the badge, too?

    I tried this, but it didn’t work:
    add_filter(‘woocommerce_sale_flash’, ‘avia_change_sale_content’, 10, 3);
    function avia_change_sale_content($content, $post, $product){
    $content = ‘<span class=”onsale”>’.__( ‘Sale custom text!’, ‘woocommerce’ ).'</span>’;
    return $content;
    }

    Thanks

Viewing 1 replies (of 1 total)
  • Worked for me. Try a higher priority parameter (which makes it execute last), and simplifying it:

    add_filter('woocommerce_sale_flash', 'avia_change_sale_content', 99);
    function avia_change_sale_content() {
      return '<span class="onsale">SALE!</span>';
    }
    

    Other things to check:
    – this code goes in functions.php in your child theme, not in style.css or as custom css
    – copy and paste the whole of functions.php into this service:
    https://phpcodechecker.com/
    to validate the code.
    – your paste shows smart quotes, make sure the actual code uses straight quotes ' "
    – the first line of functions.php is <?php to switch php on.
    – that maybe the badge is there but it is say white text on white so you can’t see it. For help with this check, and for changing the background colour, please post the url to a product which is on sale.

Viewing 1 replies (of 1 total)
  • The topic ‘Change Sale Badge’ is closed to new replies.