Woocommerce- Disappearing price on product variations bug fix

I had a new client phone me asking to look into a weird problem he was having with WooCommerce. The bug was one of those really tricky ones that didn’t make much sense. I’ll explain the bug and how I fixed it.

My client had quite a few products with variations. On some of those products the price would appear then disappear… or not show at all. The strange thing was on other products with variations it was fine and showing as it should. It didn’t matter which drop down variation I clicked on, the price just wouldn’t show for any of them.

I did what most would do first, I duplicated a product that was working and modified it. When it was saved and previewed… still didn’t work! So that wasn’t it.

It took a little while to figure out but the answer to this weird WooCommerce bug was that it only affected product variations which had the ‘same price‘ for each variation. WooCommerce doesn’t seem to be happy with same-priced variations on my clients site. What I needed was a little bit of code to tell WooCommerce that if a product has the same price for the variations it really, really does still need to display the price.

This was the code I added to the functions.php file for his theme. I placed it at the end of the page:

add_filter( ‘woocommerce_show_variation_price’, function() {
return true;
} );

That was all it needed and after that every product displayed the price as it should.

I hope that helps others because it took a while to figure out what the problem was!

Simon Day

If you have a wedding, portrait, event or festival coming up please contact me. Likewise for portraits. Check out my social media channels: Instagram | Facebook | Twitter