Answer the question
In order to leave comments, you need to log in
How to swap the price of a variable product?
When choosing a variable product, the price changes depending on the color. It is necessary that the price be displayed at the top, because. below it is not always visible.
How to do this, despite the fact that when choosing a regular (not variable) product, the price is in the right place.
Is it possible to remove this variable price from the product card at all?
Answer the question
In order to leave comments, you need to log in
If you know how to work with WordPress hooks, you can try to move this price up. You need to remove the woocommerce_single_variation function that adds an empty block for the price from the woocommerce_single_variation action and add it somewhere else in the variation form because the woocomers js only expects the price there. More or less like this
remove_action( 'woocommerce_single_variation', 'woocommerce_single_variation', 10);
add_action( 'woocommerce_before_variations_form', 'woocommerce_single_variation', 20);
To completely remove the price range.
add_filter( 'woocommerce_variable_sale_price_html', 'my_remove_variation_price', 10, 2 );
add_filter( 'woocommerce_variable_price_html', 'my_remove_variation_price', 10, 2 );
function my_remove_variation_price( $price ) {
$price = '';
return $price;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question