Showing sale percentage on products Brooklyn Theme

New Member
5 0 0

As stated, i would like help on the coding for above case, i read some old links such as;

https://ecommerce.shopify.com/c/ecommerce-design/t/showing-sale-percentage-on-products-brooklyn-them...

This worked for the collection page but not for product page.

I cant seem to find {% if product.compare_at_price > product.price %} in product.liquod.

 

Any advise?

 

Thanks

 

0 Likes
Highlighted
Shopify Staff
Shopify Staff
33 0 4

Hi Jack!

Great to see that you were able to implement something that worked for your collection pages. I'd be happy to troubleshoot getting you a percentage on your product page!

Here are the steps I followed to achieve the below:

  1. Go to Online Store > Actions > Duplicate 
    Because it's always good to have a backup! 

  2. Click Actions > Edit Code then open the product-template.liquid found under Sections

  3. Around line 75, enter the following:

    Save {{ product.price | times: -100 | divided_by: product.compare_at_price_max | plus: 100 | ceil | append: '%' }}!

Hopefully this was helpful, Jack! Are you in a sale season right now? If so, I'd be curious to hear what marketing strategies you're using to drive traffic to these!

1 Like
New Member
2 0 0

Hey, great advice. But "Around line 75"? Can you be more specific please as to what line to look for? When I go around there it shows nothing of the sort that your screenshot shows.

0 Likes
New Member
1 0 1

Not sure if you figured this out, but it took me a while to figure it out.

Here to help! :)

Search for this line:

 

 

{% include 'product-price', variant: current_variant %}

and insert the code below it.

Final code looks like this.

{% include 'product-price', variant: current_variant %}
Save {{ product.price | times: -100 | divided_by: product.compare_at_price_max | plus: 100 | ceil | append: '%' }}!

 

 

check out thetravelpact.com

 

1 Like
New Member
1 0 0

I made this change to my site, and it worked on sale pages. But on non-sale pages it still calculates the price vs. compare at price. Even if both are the same it will show up as Save -0%.

 

What code is required to make sure that it only applies to on sale items?

 

2_5oz_Mini_Portable_Espresso_Maker_–_Valta_Gear.jpg

 7oz_Insulated_Goat_Horn_Mug_–_Valta_Gear.jpg

0 Likes