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

How to fix a liquid error on a sale product page?

How to fix a liquid error on a sale product page?

meinbudgetplane
New Member
6 0 0

Hi all,

 

I have this Error on my products which are on sale. I couldnt find the error. Actually I dont know where to find and correct it. Could you please help me?

 

 

error.png

Replies 9 (9)

omarhussain
Shopify Partner
32 5 7

can you please share your site link and if you can give access of your site i will fix it for you

 

kgbfashionista
Navigator
345 24 47

Go to Online Store -> Themes -> Edit code. Look for snippets and find card-product.liquid

On the line 133 something is not quite right. Would you mind sending here lines 130-135?

Feel free to like my post if it was helpful at all
meinbudgetplane
New Member
6 0 0

>

{{ product_card_product.compare_at_price | minus: product_card_product.price | times: 100 | divided_by: product_card_product.compare_at_price }}% OFF

</span>

omarhussain
Shopify Partner
32 5 7

replace with this code



{% if product_card_product.compare_at_price > 0 %} {{ product_card_product.compare_at_price | minus: product_card_product.price | times: 100 | divided_by: product_card_product.compare_at_price }}% OFF {% else %} 0% OFF {% endif %}

meinbudgetplane
New Member
6 0 0

Okay it worked but now there is 0% off... 

off.png

kgbfashionista
Navigator
345 24 47
{% if product.compare_at_price > 0 %} {{ product.compare_at_price | minus: product.price | times: 100 | divided_by: product.compare_at_price }}% OFF {% else %} {% endif %}

 

I am guessing this is what you need.

Feel free to like my post if it was helpful at all
meinbudgetplane
New Member
6 0 0

Now it looks like this: but its actually not 30%... 😄

 

%.png

meinbudgetplane
New Member
6 0 0

Maybe you can help me also with this: I tried everything but its not wirking.. 😄 just want to center the title... Thanks in advanceTitel.png

Beile
Visitor
2 0 1

Hi. I have same problem with coding of product-price.liquid. Would you be able to advise me the correct using I should replace that line with? Currently I have 

<span class="badge sale-badge" data-label-sale> -{{ product.variants[0].compare_at_price | minus:product.variants[0].price | times:100 | divided_by:product.variants[0].compare_at_price }}%</span>