Only show lowest price
-
For standard variable product I use the filter woocommerce_variable_price_html to show the lowest price on the archive pages. I want to do the same for the composite products. How can I achieve this? The snippet I’m using for the standard variable products is this:
add_filter( 'woocommerce_variable_price_html', 'wpx_variation_price_format_min', 9999, 2 ); function wpx_variation_price_format_min( $price, $product ) { $prices = $product->get_variation_prices( true ); $min_price = current( $prices['price'] ); $max_price = end( $prices['price'] ); $min_reg_price = current( $prices['regular_price'] ); $max_reg_price = end( $prices['regular_price'] ); if ( $min_price !== $max_price || ( $product->is_on_sale() && $min_reg_price === $max_reg_price ) ) { $price = 'Vanaf: ' . wc_price( $min_price ) . $product->get_price_suffix(); } return $price; }
- The topic ‘Only show lowest price’ is closed to new replies.