{"id":990,"date":"2016-05-27T11:09:34","date_gmt":"2016-05-27T10:09:34","guid":{"rendered":"https:\/\/simonday.com\/web-design-news\/?p=990"},"modified":"2016-05-27T11:54:46","modified_gmt":"2016-05-27T10:54:46","slug":"woocommerce-disappearing-price-on-product-variations-bug-fix","status":"publish","type":"post","link":"https:\/\/simonday.com\/news\/woocommerce-disappearing-price-on-product-variations-bug-fix\/","title":{"rendered":"Woocommerce- Disappearing price on product variations bug fix"},"content":{"rendered":"<p>I had a new client phone me asking to look into a weird problem he was having with WooCommerce.\u00a0The bug was one of those really tricky ones that didn&#8217;t make much sense. I&#8217;ll explain the bug and how I fixed it.<!--more--><\/p>\n<p>My client had quite a few products with variations. On some of those products the price would appear then disappear&#8230; or not show at all. The strange thing was on other products with variations it was fine and showing as it should. It didn&#8217;t matter which drop down variation I clicked on, the price just wouldn&#8217;t show for any of them.<\/p>\n<p>I did what most would do first, I duplicated a product\u00a0that was working and modified it. When it was saved and previewed&#8230; still didn&#8217;t work! So that wasn&#8217;t it.<\/p>\n<p>It took a little while to figure out but the answer to this weird WooCommerce bug was that it\u00a0only affected product variations which had\u00a0the &#8216;<strong>same price<\/strong>&#8216; for each variation. WooCommerce doesn&#8217;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.<\/p>\n<p>This was the code I added to the functions.php file for his theme. I placed it at the end of the page:<\/p>\n<p><strong>add_filter( &#8216;woocommerce_show_variation_price&#8217;, function() {<\/strong><br \/>\n<strong>return true;<\/strong><br \/>\n<strong>} );<\/strong><\/p>\n<p>That was all it needed and after that every product displayed the price as it should.<\/p>\n<p>I hope that helps others because it took a while to figure out what the problem was!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I had a new client phone me asking to look into a weird problem he was having with WooCommerce.\u00a0The bug was one of those really tricky ones that didn&#8217;t make much sense. I&#8217;ll explain the bug and how I fixed it.<\/p>\n","protected":false},"author":2,"featured_media":998,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[128,127],"class_list":["post-990","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-help-guide","tag-price-bug","tag-woocommerce"],"_links":{"self":[{"href":"https:\/\/simonday.com\/news\/wp-json\/wp\/v2\/posts\/990","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/simonday.com\/news\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/simonday.com\/news\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/simonday.com\/news\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/simonday.com\/news\/wp-json\/wp\/v2\/comments?post=990"}],"version-history":[{"count":8,"href":"https:\/\/simonday.com\/news\/wp-json\/wp\/v2\/posts\/990\/revisions"}],"predecessor-version":[{"id":1000,"href":"https:\/\/simonday.com\/news\/wp-json\/wp\/v2\/posts\/990\/revisions\/1000"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/simonday.com\/news\/wp-json\/wp\/v2\/media\/998"}],"wp:attachment":[{"href":"https:\/\/simonday.com\/news\/wp-json\/wp\/v2\/media?parent=990"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/simonday.com\/news\/wp-json\/wp\/v2\/categories?post=990"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/simonday.com\/news\/wp-json\/wp\/v2\/tags?post=990"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}