Answer the question
In order to leave comments, you need to log in
How to add the word Discount before the percentage?
Hey!
I'm going to add the word "Discount" to the products on WooCommerce before the percentage.
Who knows php well, tell me where in the code you need to add the word?
PHP code:
<?php elseif($product->is_on_sale() && $flatsome_opt['sale_bubble_percentage'] && $product->product_type == 'simple') : ?>
<div class="callout <?php echo $flatsome_opt['bubble_style']; ?>">
<div class="inner">
<div class="inner-text"><?php
$price = '';
$percentage = round( ( ( $product->regular_price - $product->sale_price ) / $product->regular_price ) * 100,0);
echo '-'.$price . sprintf( __('%s', 'woocommerce' ), $percentage . '%' ); ?></div>
</div>
</div><!-- end callout -->
<div class="callout style2">
<div class="inner">
<div class="inner-text">-7%</div>
</div>
</div><!-- end callout -->
Answer the question
In order to leave comments, you need to log in
echo 'Скидка -'.$price . sprintf( __('%s', 'woocommerce' ), $percentage . '%' ); ?></div>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question