-
-
Save tavomak/14a2638b4134739e0784c83ad172f22f to your computer and use it in GitHub Desktop.
Woocommerce get price in custom loop
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 | |
global $woocommerce; | |
$currency = get_woocommerce_currency_symbol(); | |
$price = get_post_meta( get_the_ID(), '_regular_price', true); | |
$sale = get_post_meta( get_the_ID(), '_sale_price', true); | |
?> | |
<?php if($sale) : ?> | |
<p class="product-price-tickr"><del><?php echo $currency; echo $price; ?></del> <?php echo $currency; echo $sale; ?></p> | |
<?php elseif($price) : ?> | |
<p class="product-price-tickr"><?php echo $currency; echo $price; ?></p> | |
<?php endif; ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment