Discount % not shows on Categories Page
-
I have this function working properly on Single Page, but its showing nothing on Categories Page. Anyone have any idea why?? Thank you!
add_filter( 'woocommerce_sale_price_html', 'woocommerce_custom_sales_price', 10, 2 ); function woocommerce_custom_sales_price( $price, $product ) { if($product->regular_price > 0 ){ $percentage = round( ( ( $product->regular_price - $product->sale_price ) / $product->regular_price ) * 100 ); } if ($percentage < 0) { return $price . sprintf( __('', 'woocommerce' ), $percentage . '%' );} else { if (is_product()) { return $price . sprintf( __('<br><span style="font-size:14px;font-weight:bold; color:#ef4136">-%s DE DESCONTO</span>', 'woocommerce' ), $percentage . '%' );} else { return $price . sprintf( __('<span style="font-size:14px;font-weight:bold; color:#ef4136">-%s DE DESCONTO</span>', 'woocommerce' ), $percentage . '%' );} } }
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Discount % not shows on Categories Page’ is closed to new replies.