right now you won’t be able to see the issue on my website, since I erased the code from the functions.php file ,it’d look really bad and the site is live.
You can replicate the issue:
I have kadence theme , I have a child theme where I put the code I already mentioned in the functions.php file.
// For product variations (on variable products)
add_filter( 'woocommerce_available_variation', 'variable_product_saving_amount', 15, 3 );
function variable_product_saving_amount( $data, $product, $variation ) {
if( $variation->is_on_sale() ) {
$saved_amount = $data['display_regular_price'] - $data['display_price'];
$percentage = round( $saved_amount / $data['display_regular_price'] * 100 );
$data['price_html'] .= '<p id="saving_total_price"><span style="font-size:16px !important;color:black !important;font-weight:bold !important;">'. __("Ahorras") .' : ' . wc_price($saved_amount) . ' ('.$percentage.'%)</span></p>';
}
return $data;
}
All my products are variables ,some with size and color attributes and others with just 1 or 2 color attibutes. The issues are on the product pages of the products with just 1 color and size attributes and also just 1 color. Other issues appear also in the shop page with products with just 1 and 2 colors.
-
This reply was modified 2 years ago by
freddyeee.