Last active
December 29, 2015 07:59
-
-
Save raphaelchaib/7640115 to your computer and use it in GitHub Desktop.
[Always display WooCommerce variable product price] If all prices for a product’s variations are the same then variation price will not be displayed. But if it is the only displayed price then you are in trouble.
To overcome this situation you can edit your template functions.php file like this:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // Display variation's price even if min and max prices are the same | |
| add_filter('woocommerce_available_variation', 'variationPriceFix', 10, 3); | |
| function variationPriceFix ($value, $object = null, $variation = null) { | |
| if ($value['price_html'] == '') { | |
| $value['price_html'] = '<span class="price">' . $variation->get_price_html() . '</span>'; | |
| } | |
| return $value; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment