stouch
Forum Replies Created
-
Forum: Plugins
In reply to: [Polylang] Doubt about Divi theme builder in footer and polylangHi, This isn’t working for me, I have created a footer layout from theme builder, and translated it but the translated version doesn’t display! https://hal.standardtouch.com/
Forum: Plugins
In reply to: [Yandex Mail SMTP Server for WordPress] PHP noticeHi there!
I have setup the correct credentials, but mails are not being delivered!
could you please let me know what could be the issue?Thanks!
Forum: Plugins
In reply to: [WooCommerce] Show % Discount on Sales BadgeHi,
I’m using this code, but it’s not working! here prajamart.com
I have added the below code after the above code din’t work
//showing save percentage value
add_filter( ‘woocommerce_get_price_html’, ‘change_displayed_sale_price_html’, 10, 2 );
function change_displayed_sale_price_html( $price, $product ) {
// Only on sale products on frontend and excluding min/max price on variable products
if( $product->is_on_sale() && ! is_admin() && ! $product->is_type(‘variable’)){
// Get product prices
$regular_price = (float) $product->get_regular_price(); // Regular price
$sale_price = (float) $product->get_price(); // Active price (the “Sale price” when on-sale)// “Saving Percentage” calculation and formatting
$precision = 1; // Max number of decimals
$saving_percentage = round( 100 – ( $sale_price / $regular_price * 100 ), 1 ) . ‘%’;// Append to the formated html price
$price .= sprintf( __(‘<p class=”saved-sale”>Save: %s</p>’, ‘woocommerce’ ), $saving_percentage );
}
return $price;
}This displays save percentage, however how to show it for variable products as well?
- This reply was modified 5 years, 2 months ago by stouch. Reason: added code
Hi,
Were you able to resolve this issue?
Even I have the same issue.