Show variable product old price next to sale price (like for simple products)

[ad_1]

Hey @katriinliselle,

Thanks for reaching out!

It looks like you want to have a strike through displayed for variable products that are on sale, the same way this appears for simple products, correct?

There is no built-in option in WooCommerce core that allows this and it would require either a plugin or custom code to achieve.

Although help with custom code is outside our scope of support, you can try the following code snippet and see if this does the trick:

https://gist.github.com/stoltzrx/e61a9abea1ca99fa5c64ab783e0692f8

I have tested this code on my test site and it is working as expected, here are the end results after applying the code snippet:

Shop page:

Single product page:

You need to add the code to your child theme’s functions.php file or via a plugin that allows custom functions to be added, such as the Code snippets plugin.

Please don’t add custom code directly to your parent theme’s functions.php file as this will be wiped entirely when you update the theme.

Hope this helps!

Thank you so much, this works perfectly!

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer