M
M
Maxim Tyulpakov2019-02-15 15:25:08
WordPress
Maxim Tyulpakov, 2019-02-15 15:25:08

How can I make it so that when selecting a specific product, only its price is displayed (and not a price range)?

The whole point of the question is stated. It's not at all clear why they made such an inconvenient decision in terms of displaying the price range.
At the moment, I found only a paid solution: www.mojomarketplace.com/item/simple-variation-pric...
I found a script that needs to be added to the theme's function.

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 ) {
  $price = wc_price( min( $product->get_variation_price( 'min', true ), $product->get_variation_price( 'max', true ) ) );
 
    return $price;
}

In connection with the found solution, the following question arose. How can I make sure that when a variable product is displayed on the store page, the price range of this product is still displayed?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question