Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
Hello
Wondering why this "if blank" doesn't work?
{%- if product.compare_at_price_max !=blank %} <span class="labelNew">{{ product.compare_at_price_max | minus: product.price | times:100 | divided_by:product.compare_at_price_max }}</span> {%- endif -%}
Hi @Hemsyd
You need to have a space between the "=" and the word blank
{%- if product.compare_at_price_max != blank %}
<span class="labelNew">{{ product.compare_at_price_max | minus: product.price | times:100 | divided_by:product.compare_at_price_max }}</span>
{%- endif -%}
Thanks for your help, but the same thing. I want it to be hidden when I don't have a discount. but now it shows (0)
Oh. Try this code instead
{%- if product.compare_at_price_max != "0" %}
<span class="labelNew">{{ product.compare_at_price_max | minus: product.price | times:100 | divided_by:product.compare_at_price_max }}</span>
{%- endif -%}
Thanks
but the same zero remains!
Someone who can be of help
Hi,
Try the code below instead
{%- if product.compare_at_price_max != 0 %}
<span class="labelNew">{{ product.compare_at_price_max | minus: product.price | times:100 | divided_by:product.compare_at_price_max }}</span>
{%- endif -%}
Hello
It's the same, I don't want it to show zero. I want it to be visible only when it is damaged
You have to find a way to differentiate the variables
Shopify and our financial partners regularly review and update verification requiremen...
By Jacqui Mar 14, 2025Unlock the potential of marketing on your business growth with Shopify Academy's late...
By Shopify Mar 12, 2025Learn how to increase conversion rates in every stage of the customer journey by enroll...
By Shopify Mar 5, 2025