Last active
May 1, 2018 09:37
-
-
Save ThomasLarge/e171635c3605539f5ecc2359d8a3177c to your computer and use it in GitHub Desktop.
WooCommeres Helpers
This file contains 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
// Add a button when there is no price displayed - edit price.php | |
<p class="price"><?php echo $product->get_price_html(); ?></p> // Remove this and replace with | |
<p itemprop="price" class="price"> | |
<?php | |
$price = $product->get_price_html(); | |
if(empty($price)) | |
{ | |
echo '<a href="link">Anchor Text</a>'; | |
} | |
else | |
{ | |
echo $price; | |
}; | |
?> | |
</p> | |
// Display Price For Variable Product With Same Variations Prices | |
add_filter('woocommerce_available_variation', function ($value, $object = null, $variation = null) { | |
if ($value['price_html'] == '') { | |
$value['price_html'] = '<span class="price">' . $variation->get_price_html() . '</span>'; | |
} | |
return $value; | |
}, 10, 3); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment