"up to" only if different amounts
-
Hi.
I changed the code, so that the text “Save up to” is only shown if the amount from child products is different. I’m not sure if this is the best way, but it works (until yet only local, so I have got no link for a demo site). Maybe you can add this to the plugin even if you have said that you don’t want to add new features.
Code changes in classes/class-woocommerce-smart-sale-badge.php:
1. Search for:
$saving_amount = 0;
Add after, in new line:
$min_saving_amount = 999999999;
2. Search for:
$saving_amount = $new_saving_amount;
Add after, in new line:
} if( $new_saving_amount < $min_saving_amount ) { $min_saving_amount = $new_saving_amount;
3. Search for:
$button_text = __( ‘Save up to’, ‘wc_smart_sale_badge’ );Change to:
if( $saving_amount != $min_saving_amount ) { $button_text = __( 'Save up to', 'wc_smart_sale_badge' ); } else { $button_text = __( 'Save', 'wc_smart_sale_badge' ); }
https://www.ads-software.com/extend/plugins/woocommerce-smart-sale-badge/
- The topic ‘"up to" only if different amounts’ is closed to new replies.