What's your biggest current challenge? Have your say in Community Polls along the right column.

Show Amount Saved on Product (for products with Variants)

Show Amount Saved on Product (for products with Variants)

Gerapreneur
Shopify Partner
4 0 0

I am trying to show the dollar amount saved on the Product info, when using Shopify's Compare at Price Feature.

 

I have used the code from https://community.shopify.com/c/shopify-discussions/show-amount-save-on-product-page-debut-theme/m-p... to implement this, and it has worked for all of my products with just one variant.

 

However when I add in 2 or more variants, then the calculation breaks and the wrong figure is shown. This resolves itself when I delete the second variant. You can see that the Superbly Stainless option (which has two variants) has the incorrect saving calculation, while the other two products which only have 1 product variant have the right saving calculation:

 

Screenshot 2023-10-31 at 4.02.58 pm.png

 

This issue occurs on all pages where the product card shows, including on the product page iteself.

 

Can anyone suggest how to adapt this code so that it works to correctly display the saving on products with multiple variants?

Replies 0 (0)