Surprisingly enough, variable products with a price range display two prices: at the top right you find the “parent” product price, displayed as a range; but once you select a variation, a second price appear just above the variation add to cart. Somewhat confusing.
In today’s snippet, we’ll see once and for all how to replace the top right variable product price with the one of the current variation, while also hiding the variation price. Therefore, you’ll see a single price on the single product page for variable products! Enjoy!

PHP Snippet: Dynamically Update Variable Product Price With Current Variation Price (Plus: Hide Variation Price)
Note: the jQuery statements included in the snippet target specific CSS classes in order to replace the price HTML. If your theme uses customized HTML and different classes, the code won’t work. Make sure to test this code on a default theme, such as Storefront, to make sure it actually works; and only then try to adjust the jQuery to target the correct non-default classes.
/**
* @snippet Replace Variable Price With Variation Price | WooCommerce
* @how-to Get CustomizeWoo.com FREE
* @author Rodolfo Melogli
* @testedwith WooCommerce 6
* @donate $9 https://businessbloomer.com/bloomer-armada/
*/
add_action( 'woocommerce_variable_add_to_cart', 'bbloomer_update_price_with_variation_price' );
function bbloomer_update_price_with_variation_price() {
global $product;
$price = $product->get_price_html();
wc_enqueue_js( "
$(document).on('found_variation', 'form.cart', function( event, variation ) {
if(variation.price_html) $('.summary > p.price').html(variation.price_html);
$('.woocommerce-variation-price').hide();
});
$(document).on('hide_variation', 'form.cart', function( event, variation ) {
$('.summary > p.price').html('" . $price . "');
});
" );
}
Screenshot after the snippet is installed and a variation is selected:

Is not working
Hello Diego, thanks so much for your comment! I just retested this on the latest version of WooCommerce and it still works. Unfortunately this looks like custom troubleshooting work and I cannot help here via the blog comments. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding! ~R
Thank you for your great snippets.
Unfortunately, it is not working for me.
Hi Omar, works for me! Can I have more context? If you disable all plugins but WooCommerce and switch to a default theme, does the code work?
Thank you!
It still works (WordPress 6.0.3 & Woocommerce 7.0.0)
Great!
Hello.
What if let’s say a product has a ‘color’ variation and all variations are the same price? Can you make it say: “Only […]” instead of: “From […]”. Now, if a product has variations with the same price it shows: “From:”, but that is the real price and is not “From”.
Hi Vlad, thanks so much for your comment! Yes, this is definitely possible, but I’m afraid it’s custom work. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding!
Hi,
First off, thank you for your snippet!
The snippet stopped working. Could you please update it to the new version of Elementor?
Thnak you,
Shai
This works for default WooCommerce. Not sure if Elementor changes anything, and therefore the code may need to be adjusted.
Thank you for the snippet. Is there a way to make it compatible with WooCommerce Subscriptions?
Leandro, thanks so much for your comment! Yes, this is definitely possible, but I’m afraid it’s custom work. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding!
Hello,
First off, thank you for your snippet.
Your code seems to remove the bottom price correctly, but the pricerange in the top stays the same after selecting a variation.
Hope you can help me out with this.
Thanks in advance!
Best regards,
Damir
Hi Damir! Did you read this:
When using this code, if a product has two variations, lets say blue and red, and both prices are the same lets say £90. The price hides. there seems to be an issue when the variations have the same price
You’re right, try this new version please and let me know