Last active
March 18, 2016 00:32
-
-
Save WPDevHQ/58718a3316b31bded9e0 to your computer and use it in GitHub Desktop.
Display WooCommerce discount in amount i.e. You Save £3.00
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function themeslug_custom_sales_price( $price, $product ) { | |
$currency = get_woocommerce_currency_symbol(); | |
$percentage = round( $product->regular_price - $product->sale_price, 2 ); | |
return $price . sprintf( __(' <br /><span class="price_save">You Save ' . $currency . '%s', 'woocommerce' ), $percentage . '</span>' ); | |
} | |
add_filter( 'woocommerce_sale_price_html', 'themeslug_custom_sales_price', 10, 2 ); ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment