How tore?

Clark has a WooCommerce store, in which he has offered discounts on some of the products. By default, the discounted price is shown with the regular price stricken out, and with Sale-flash, as shown in the screenshot below.

Further, Clark wants to hide the Sale-flash.

Here’s how Clark can hide the Sale-Flash  from Products:

The following code snippet is to hide the Sale-Flash from all the products. This code snippet works only for discounts (or price adjustments) made using Dynamic Pricing and Discounts Plugin for WooCommerce or WooCommerce Catalog Mode, Wholesale & Role Based Pricing plugins.

Add the code snippet to the functions.php file of your website theme.

// Display woocommerce_sale_flash only when there is sale price 
add_filter( 'woocommerce_sale_flash', 'filter_woocommerce_sale_flash', 10, 3 ); 
function filter_woocommerce_sale_flash( $span_class_onsale_esc_html_sale_woocommerce_span, 
$post, $product ) {
return $product->get_sale_price() ? $span_class_onsale_esc_html_sale_woocommerce_span : ''; 
};

If you wish tore, regardless of any plugin, use the following code snippet.

//Remove woocommerce_sale_flash completely
 add_filter('woocommerce_sale_flash', 'woo_custom_hide_sales_flash');
 function woo_custom_hide_sales_flash()
 {
 return false;
 }

Tip: The above code snippet can also be added if you are offering products at the sale price for a long period of time, and to hide sale-flash.

Here’s how Clark’s shop will look after the code snippet is added.

 

For any queries, feel free to contact our support team.

Leave a Reply