"You save %" text not updating with variants (Brooklyn theme)

New Member
3 0 0

I have a code implemented into our product-template.liquid file in Brooklyn theme:

  {% if product.compare_at_price > product.price %}You save <strong><span style="color:#43cc5b">{{ product.compare_at_price | minus: product.price | times: 100.0 | divided_by: product.compare_at_price | money_without_currency | times: 100 | remove: '.0'}}%{% endif %}

This works perfectly for the standard variant of a product (on the product page), however the percent does not update when a different variant is selected. How can we go about implementing this? I have looked around and it looks like javascript needs to also be implemented, but I am not able to figure how to do it for the Brooklyn theme

0 Likes
New Member
3 0 0

:(, still not able to figure this out

0 Likes
New Member
3 0 0

Still need help on this

0 Likes
Shopify Partner
134 1 15

Hi there,

You will indeed need to use Javascript to do this. Are you familiar with JS at all? 

If you are, you should be able to go into the 'theme.js' file and find the section that dictates what happens when a product variant is changed, then add some code in here to change your '% off' text.

If you need a hand you can contact me directly on elliot@mandelbrotian.com, or have a look on the Shopify Experts page at https://experts.shopify.com/

Cheers,

Elliott

Feeling a bit lost? Contact elliot@mandelbrotian.com for help with theme setup, alterations, custom functionality, and app development.
0 Likes
Highlighted
New Member
2 0 0

i have same problem in my brooklyn theme. when is select different variant, but not change save parentage. you fix out this issue in brooklyn theme?

0 Likes