Skip to content

Instantly share code, notes, and snippets.

@tozbey
Created October 24, 2019 18:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tozbey/7f0c00f53056b6fc23f0f7b8958f2c54 to your computer and use it in GitHub Desktop.
Save tozbey/7f0c00f53056b6fc23f0f7b8958f2c54 to your computer and use it in GitHub Desktop.
Add save amount next to sale item prices
// 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