Dear @kmc,
Could you kindly provide some screenshots? We are still not entirely clear about your requests.
Best regards,
8Theme Team
5 replies2 participantsUpdated by Luca Rossi
Now if a variation product has only one variable option has discount, it doesn’t show strikeout original price and new price, may I know how to show original strikeout price and sales price even only one variation has discount, for both product page and archive page.
Dear @kmc,
Could you kindly provide some screenshots? We are still not entirely clear about your requests.
Best regards,
8Theme Team
Please see attached. You can see from the archive page and product page we cannot see there is actually a discount, unless we select the discounted variation, we can see the strikeout price.
Hi @kmc,
Please try adding this custom code under functions.php file locates in your child theme:
// Display regular price alongside sale price for variable products
add_filter('woocommerce_variable_sale_price_html', 'custom_variable_sale_price_display', 10, 2);
add_filter('woocommerce_variable_price_html', 'custom_variable_sale_price_display', 10, 2);
function custom_variable_sale_price_display($price, $product) {
// Get min and max prices
$min_regular_price = $product->get_variation_regular_price('min', true);
$min_sale_price = $product->get_variation_sale_price('min', true);
$max_regular_price = $product->get_variation_regular_price('max', true);
$max_sale_price = $product->get_variation_sale_price('max', true);
// Check if product has sale price
if ($min_sale_price !== $min_regular_price || $max_sale_price !== $max_regular_price) {
if ($min_sale_price === $max_sale_price && $min_regular_price === $max_regular_price) {
// Single price (all variations have same price)
$price = '<del>' . wc_price($min_regular_price) . '</del> <ins>' . wc_price($min_sale_price) . '</ins>';
} else {
// Price range - show both regular and sale ranges
$price = '<del>' . wc_price($min_regular_price) . ' - ' . wc_price($max_regular_price) . '</del> <ins>' . wc_price($min_sale_price) . ' - ' . wc_price($max_sale_price) . '</ins>';
}
}
return $price;
}
Hope it helps!
Seems still not correct, after I add the code, it only displays one price for the variable product for the archive page and the product page. See attached.
By right it should still show the original price ranges and strike out, then the discount price range.
Hi @kmc,
By default, WooCommerce does not display the original price for variable products.
If you would like to extend the code provided above, we recommend seeking assistance from tools such as ChatGPT or Claude.AI.
Please note that custom development falls outside the scope of the standard support services we provide.
Thank you for your understanding.
Best regards,
8Theme’s Team
Want to reply? Log in, or register with your ThemeForest purchase code, to reply to this topic.
Free AI store scan · SalesMax
Paste your store address. SalesMax AI shows which upsell moments are missing. No signup.
Free AI speed test · FlashMax
Paste your site address. FlashMax runs Google Lighthouse for phone and desktop, checks Core Web Vitals and lists what to fix. No signup.
Painting studioBooks & art
(live demo, opens in a new tab)
Lifestyle BlogFashion
(live demo, opens in a new tab)
Digital MarketingBusiness
(live demo, opens in a new tab)
Bike StoreSports & travel
(live demo, opens in a new tab)
EcoenergyElectronics
(live demo, opens in a new tab)
FishingSports & travel
(live demo, opens in a new tab)
Beauty & CosmeticsBeauty
(live demo, opens in a new tab)
Industrial Power Tools StoreElectronics
(live demo, opens in a new tab)
Animals StorePets
(live demo, opens in a new tab)
TransportCars & bikes
(live demo, opens in a new tab)
Furniture StoreFurniture
(live demo, opens in a new tab)
Glasses StoreFashion
(live demo, opens in a new tab)
Online CoursesBusiness
(live demo, opens in a new tab)
Chocolate BoutiqueFood & drinks
(live demo, opens in a new tab)
Jewelry StoreJewellery
(live demo, opens in a new tab)
Transportation and LogisticsCars & bikes
(live demo, opens in a new tab)