• Hi, I am using WooCommerce with the Kallyas theme. I would like to replace the sale badge icon image to a custom one that is in the shape of a ribbon instead of the standard callout bubble that is currently showing. How can I do that? I’ve tried adding the following code to my functions.php file but it didn’t do anything….

    add_filter( ‘woocommerce_sale_flash’, ‘my_custom_sales_badge’ );
    function my_custom_sales_badge() {
    $img = ‘<span class=”onsale”></span>’;
    return $img;
    }

    The website is: dressforhumanity.com

    Thank you.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter sjahan

    (@sjahan)

    Here is the code:

    add_filter( 'woocommerce_sale_flash', 'my_custom_sales_badge' );
    function my_custom_sales_badge() {
    	$img = '<span class="onsale"><img src="https://www.dressforhumanity.com/wp-content/uploads/2016/11/Sale-Badge.png" /></span>';
    	return $img;
    }
    Plugin Support RK a11n

    (@riaanknoetze)

    That theme is hijacking the default HTML used by WooCommerce for the sale badge. By the looks of things, you’d need to adjust that using CSS instead of PHP.

    That said, I’d recommend reaching out to the developers of that theme for more support on this.

    You might try setting a priority parameter in the add_filter call:

    
    add_filter( 'woocommerce_sale_flash', 'my_custom_sales_badge', 99 );
    

    A higher number executes later.

    Thread Starter sjahan

    (@sjahan)

    That worked great!!! Thank you so much @lorro!!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Custom Sale Badge Image’ is closed to new replies.