Home » WooCommerce: Disable Grouped Product Price Range $$$-$$$

WooCommerce: Disable Grouped Product Price Range $$$-$$$

by Tutor Aspire

You may want to disable the Grouped product price range on the Shop and Single Product page. This usually looks like $100-$999. With this snippet you will be able to display “From: ” in front of the minimum price, or otherwise completely hide it 🙂

Change the display of price range for Grouped Products

PHP Snippet #1: Change WooCommerce Grouped Product Price Range Format $$$-$$$

/**
 * @snippet       Change Grouped Product Price Range
 * @how-to        Get tutoraspire.com FREE
 * @sourcecode    https://tutoraspire.com/?p=22191
 * @author        Tutor Aspire
 * @testedwith    WooCommerce 3.4.1
 */

add_filter( 'woocommerce_grouped_price_html', 'tutoraspire_grouped_price_range_from', 10, 3 );

function tutoraspire_grouped_price_range_from( $price, $product, $child_prices ) {
$prices = array( min( $child_prices ), max( $child_prices ) );
$price = $prices[0] !== $prices[1] ? sprintf( __( 'From: %1$s', 'woocommerce' ), wc_price( $prices[0] ) ) : wc_price( $prices[0] );
return $price;
}

PHP Snippet #2: Remove WooCommerce Grouped Product Price Range Entirely $$$-$$$

/**
 * @snippet       Remove Grouped Product Price Range
 * @how-to        Get tutoraspire.com FREE
 * @sourcecode    https://tutoraspire.com/?p=22191
 * @author        Tutor Aspire
 * @compatible    WooCommerce 3.0.4
 */

add_filter( 'woocommerce_grouped_price_html', 'tutoraspire_grouped_price_range_delete', 10, 3 );

function tutoraspire_grouped_price_range_delete( $price, $product, $child_prices ) {
$price = '';
return $price;
}

You may also like