Black Friday & Cyber Monday SUPER SALE ALL WEEK:
Grab 40% OFF on plugins
Days
Hours
Minutes
Seconds

How to Disable Variable Product Price Range on the WooCommerce Single Product Page?

In WooCommerce, the variable product price details are shown in a range as shown here in the image.

How to Disable Variable Product Price Range on the WooCommerce Single Product Page? - Tyche Softwares

But many businesses require customers to contact them for a quote or request custom pricing. This is particularly required for business models where pricing depends on specific customer needs, such as bulk orders or for customized items. In such cases, showing a price could confuse customers or fail to reflect the actual cost. This code will help you hide the price range for variable products, allowing you to tailor pricing to each customer’s unique requirements.

Solution: Disable Variable Product Price Range on the WooCommerce Single Product Pages

The code below will hide both the price range and the individual variation price on the WooCommerce single product page.

add_filter( 'woocommerce_format_price_range', 'ts_disable_variable_price_range', 10, 3 );

function ts_disable_variable_price_range( $price, $from, $to ) {
    // Check if it's a variable product
    if ( is_product() && has_term( 'variable', 'product_type' ) ) {
        return ''; // Return empty to hide the price range
    }
    return $price; // Otherwise, return the normal price range
}

Output

When a customer visits a variable product page on the website, the default price range (e.g., “From $30 to $50”) that typically appears for variable products will be completely disabled and hidden. Additionally, even if the customer selects a particular variation (such as size or color), the dynamic price update that usually displays the price of the selected variation will also be hidden.

How to Disable Variable Product Price Range on the WooCommerce Single Product Page? - Tyche Softwares

For businesses that want to show price information but still offer flexibility in pricing based on product variations, managing this dynamically is essential. For example, rental businesses that offer variable products can display the price range based on the number of days selected for the rental. This can be easily achieved with plugins like the Booking & Appointment Plugin for WooCommerce, which allows store owners to configure pricing by the range of days for each variation.

Browse more in: Code Snippets, WooCommerce How Tos, WooCommerce Tutorials

Share It:

Subscribe
Notify of
0 Comments
Newest
Oldest
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x