Last active
March 18, 2019 12:44
-
-
Save blivic/2abc949f53f5502eecf2637281c251c2 to your computer and use it in GitHub Desktop.
Show amount for 3, 6 and 12 installments, under regular price
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
add_action( 'woocommerce_single_product_summary', 'mx_price_per_installments', 11 ); | |
function mx_price_per_installments() { | |
global $product; | |
$price = $product->get_price(); | |
$threeinstallments = 3; | |
$sixinstallments = 6; | |
$twelveinstallments = 12; | |
$price_per_threemonths = round ($price / $threeinstallments , wc_get_price_decimals(), PHP_ROUND_HALF_DOWN); | |
$price_per_sixmonths = round ($price / $sixinstallments , wc_get_price_decimals(), PHP_ROUND_HALF_DOWN); | |
$price_per_twelvemonths = round ($price / $twelveinstallments , wc_get_price_decimals(), PHP_ROUND_HALF_DOWN); | |
echo " | |
<div id='installments-container'> | |
<div id='installments-text'> | |
Obročno plaćanje: 3 x <span>". $price_per_threemonths ." Kn</span> | 6 x <span>". $price_per_sixmonths ." Kn</span> | 12x <span>". $price_per_twelvemonths ." Kn</span> | |
</div> | |
</div> | |
"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment