Created
October 24, 2019 18:34
-
-
Save tozbey/7f0c00f53056b6fc23f0f7b8958f2c54 to your computer and use it in GitHub Desktop.
Add save amount next to sale item prices
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
// Add save amount next to sale item prices | |
add_filter( 'woocommerce_get_price_html', 'modify_woocommerce_get_price_html', 10, 2 ); | |
function modify_woocommerce_get_price_html( $price, $product ) { | |
if( $product->is_on_sale() && ! is_admin() ) | |
return $price . sprintf( __('<p class="saveprice">Du sparar: <span class="woocommerce-Price-amount amount">%s <span class="woocommerce-Price-currencySymbol">kr</span></span></p>', 'woocommerce' ), $product->regular_price - $product->sale_price ); | |
else | |
return $price; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment