Answer the question
In order to leave comments, you need to log in
How to split price in woocommerce?
Please tell me there is a code
add_filter( 'woocommerce_variable_sale_price_html', 'wc_wc20_variation_price_format', 10, 2 );
add_filter( 'woocommerce_variable_price_html', 'wc_wc20_variation_price_format', 10, 2 );
function wc_wc20_variation_price_format( $price, $product ) {
// Основная цена
$prices = array( $product->get_variation_price( 'max', true ), $product->get_variation_price( 'max', true ) );
$price = $prices[0] !== $prices[1] ? sprintf( __( '%s', 'woocommerce' ), wc_price( $prices[0] ) ) : wc_price( $prices[0] );
return $price ;
}
Answer the question
In order to leave comments, you need to log in
Replace with , it may need to be converted to int, because I don’t know what value you have in the array. wc_price( $prices[0] )
wc_price( $prices[0] / 30)
$prices[0]
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question