in map domain.com/wp-content/themes/woodmart/inc/integrations/wooco… open file template-tags.php edit line starting with if ( $product->is_on_sale() ) to if ($product->is_on_sale()) { $discount_amount = ''; if ($product->get_type() == 'variable') { $available_variations = $product->get_variation_prices(); $max_discount_amount = 0; foreach ($available_variations['regular_price'] as $key => $regular_price) { $sale_price = $available_variations['sale_price'][$key]; if ($sale_price < $regular_price) { $discount = (float) $regular_price - (float) $sale_price; if ($discount > $max_discount_amount) { $max_discount_amount = $discount; } } } $discount_amount = $max_discount_amount; } elseif (in_array($product->get_type(), ['simple', 'external', 'variation'])) { $regular_price = (float) $product->get_regular_price(); $sale_price = (float) $product->get_sale_price(); $discount_amount = $regular_price - $sale_price; } if ($discount_amount) { $output[] = '<span class="onsale product-label">' . sprintf(_x('-%s', 'sale discount amount', 'woodmart'), wc_price($discount_amount)) . '</span>'; } else { $output[] = '<span class="onsale product-label">' . esc_html__('Sale', 'woodmart') . '</span>'; } echo implode('', $output); // Echo the output }
this is a very good idea.
This functionality is available through a combination of the newly added Custom Label Builder features and Dynamic Data.