[WooCommerce] Price Variations mixed min/max
-
Hi all!
I have been working on a problem since yesterday noon and cannot seem to fix it. I upload products with CSV Product Import Suite to WooCommerce and want to display only the min price for variation products in the product list.
To achieve this I edited my child theme’s function.php with
<?php // Use WC 2.0 variable price format 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 ) { $min_price = $product->get_variation_price( 'min', true ); $max_price = $product->get_variation_price( 'max', true ); if ($min_price != $max_price){ $price = sprintf( __( 'From: %1$s', 'woocommerce' ), wc_price( $min_price ) ); return $price; } else { $price = sprintf( __( '%1$s', 'woocommerce' ), wc_price( $min_price ) ); return $price; } } ?>
This removes the display of the price range as well as the strikethrough.
However, for some variable products it works, for some it still shows the max price! I can only get to display the min price when I click edit product and immediately update it without making ANY changes. It does not work for quick edit though.
Does anyone have a workaround for this? Manually editing and updating myriads of products is just not feasible .
Any help is much, much appreciated!
Thanks
- The topic ‘[WooCommerce] Price Variations mixed min/max’ is closed to new replies.