Last active
August 29, 2015 13:56
-
-
Save marcosfreitas/9070982 to your computer and use it in GitHub Desktop.
Override price.php file - woocommerce - price do not returns decimal zero - put this script in "your-theme/woocommerce/loop/price.php"
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
<?php | |
/** | |
* Loop Price | |
* Overriding original price.php | |
* @author Marcos Freitas - WooThemes | |
* @package WooCommerce/Templates | |
* @version 1.6.4 | |
*/ | |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly | |
global $product; | |
/** | |
* Deixei a verificação original | |
* o price_html não estava retornando as casas decimais quando elas eram zeros | |
*/ | |
if ( $price_html = $product->get_price_html() ) : | |
$currency = get_woocommerce_currency_symbol(); // pega o símbolo da moeda | |
$price_value = number_format($product->price, 2, ',', '.'); // formata o valor para o padrão BR | |
?> | |
<div class="price"><span class="amount"><?php echo $currency.' '.$price_value;?> </span></div> | |
<?php | |
endif; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment