WoodMartW
WoodMart
Mar 12

"You save"

A "You save" line when using dynamic discounts, in product price, cart and checkout. For eyample: "You save € 5,60". What means, the customer can see his real saving in money, notonly the percentual discount. Thank you in advance!
PendingPending

Mar 12, 2025

you can use this snippet for it add_action('woocommerce_before_add_to_cart_form', 'display_you_save_amount'); function display_you_save_amount() { global $product; if ($product->is_on_sale()) { $regular_price = floatval($product->get_regular_price()); $sale_price = floatval($product->get_sale_price()); if ($regular_price > $sale_price && $regular_price > 0) { $discount_percentage = round((($regular_price - $sale_price) / $regular_price) * 100); echo '<p class="you-save-text">You Save ' . $discount_percentage . '%</p>'; } } } Simple css code .you-save-text { font-size: 16px; font-weight: bold; color: #ff6000; margin-top: 10px; }