Home › Forums › WoodMart support forum › variation product price show zero › Reply To: variation product price show zero
May 24, 2024 at 9:51 am
#567935
Aizaz Imtiaz Awan
Keymaster
Hello,
Please remove the previous code add the below code to the functions.php file in the Child theme:
function custom_pric_sale_price_html( $price, $product ) {
if ( $product->is_on_sale() ) {
$regular_price = wc_get_price_to_display( $product, array( 'price' => $product->get_regular_price() ) );
$sale_price = wc_get_price_to_display( $product, array( 'price' => $product->get_sale_price() ) );
$price = '<del>' . wc_price( $regular_price ) . '</del> <br> <ins>' . wc_price( $sale_price ) . '</ins>';
}
return $price;
}
add_filter( 'woocommerce_get_price_html', 'custom_pric_sale_price_html', 10, 2 );
Best Regards.