Need Help With Discount Rules and Dynamic Pricing Plugin
-
Hi,
My name is Santiago and I am writing to you because I am having problems with the Dynamic Pricing and Discount Rules plugin for WooCommerce.We need to show discount percentage and save money. Now we are using this code in function.php file but it is not working. I share a screen shot :
Code:
add_filter( ‘woocommerce_format_sale_price’, function($price, $regular_price, $sale_price ){
if(!is_float($regular_price) ) $regular_price = floatval($regular_price);
if(!is_float($sale_price) ) $sale_price = floatval($sale_price);
if(!$regular_price) return $price;
$precision = 1;
$saving_price = wc_price($regular_price – $sale_price );
$saving_percentage = round( 100 – ( (float)$sale_price / (float)$regular_price * 100 ), 1 ) . ‘%’;
$price .= sprintf( __(‘<br><small><span class=”snippet-dto-ahorro”>Ahorras:</span> <span class=”snippet-dto-precio”>%s</span> <span class=”snippet-dto-porcentaje”>(%s)</span></small>’, ‘woocommerce’ ), $saving_price, $saving_percentage );
return $price;
},10,3);The page I need help with: [log in to see the link]
- The topic ‘Need Help With Discount Rules and Dynamic Pricing Plugin’ is closed to new replies.