if price is between specific amount condition

Solved
New Member
2 0 0

Hi,

I'm trying to create a condition, if the price is over $50 and less than $100 then it should display "hello world"

{% if product.price > 50 and product.price > 100 %}
hello world
{% endif %}

after some work, I realized that the "less-then" sign doesn't work. For example, the following code doesn't work:

 

 

{% if product.price < 100 %}
hello world
{% endif %}

but this does work:

{% if product.price > 50 %}
hello world
{% endif %}

Anyone can help here?

Thank you

 

 

0 Likes

Success.

Shopify Expert
51 12 7

Hi HY,

 

Currency in liquid isn't formatted as whole numbers, so $50 would actually be a value of '5000' and $100 would be '10000'. Almost like you're defining cents, not dollars.

 

Update those values and your code should work.

1 Like
New Member
2 0 0

Thank you very much.

 

0 Likes