Skip to content

Instantly share code, notes, and snippets.

@kabbo508
Created October 15, 2017 18:05
Show Gist options
  • Save kabbo508/e643dae7a1b05b73cabc84522f055a73 to your computer and use it in GitHub Desktop.
Save kabbo508/e643dae7a1b05b73cabc84522f055a73 to your computer and use it in GitHub Desktop.
Add text before sale price only in Woocomemrce
function bd_sale_price_html( $price, $product ) {
if ( $product->is_on_sale() ) :
$return_string = str_replace( '<ins>, '<ins><br>Sale Price: ', $price);
return $return_string;
else :
return $price;
endif;
}
add_filter( 'woocommerce_get_price_html', 'bd_sale_price_html', 100, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment