# Hide the Price Range Until a Variation Is Chosen

> Removes the "10.00 to 50.00" range at the top of variable product pages, so the exact price appears only once the shopper picks options.

- Type: PHP
- Runs: Run everywhere
- Category: [WooCommerce](https://wpide.com/library/category/woocommerce/)
- Requires: WooCommerce
- Tags: woocommerce, variations, prices, product-page
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/woo-hide-variable-price-range/

## Code

```php
add_filter( 'woocommerce_get_price_html', function ( $html, $product ) {
    if ( ! is_product() || ! $product->is_type( 'variable' ) || $product->get_id() !== get_queried_object_id() ) {
        return $html;
    }

    if ( doing_action( 'woocommerce_single_product_summary' ) && $product->get_variation_price( 'min' ) !== $product->get_variation_price( 'max' ) ) {
        return '';
    }

    return $html;
}, 20, 2 );

add_filter( 'woocommerce_show_variation_price', '__return_true' );
```

## Notes

Shop listings keep their price range, and the variation price shows even when all variations cost the same.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Hide the Price Range Until a Variation Is Chosen" in its snippet library and add it in one click; or create a new PHP snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
