Collection if else condition not working, need help

Collection if else condition not working, need help

Arkligte
Shopify Partner
9 1 1

Hi, need help.

 

Condition is, if a collection called "INTERIOR" (handle is 'interior') has products that cost more than 1000, it should show "price on request".

 

I am using following codes, but it's not working. Rest of the collection should show regular prices without any condition. I am not sure what I am doing wrong.

 

Tried this one

{% assign collection_handle = 'interior' %}

{% if product.price > 100000 and collections[collection_handle].products %} Price on request

{% else %}

{{ money_price }}

{% endif %}

 

Tried this one too

{% assign collection_handle = 'interior' %}

{% for product in collections[collection_handle].products %}

{% if product.price > 100000 %} Price on request

{% else %} {{ money_price }}

{% endif %} {% endfor %}

Replies 2 (2)

ThePixelEdge
Shopify Partner
164 16 17

Hello @Arkligte 
Try with the below code

{% assign collection_handle = 'interior' %}

{% for product in collections[collection_handle].products %}
    {% if product.price > 100000 %}
        Price on request
    {% else %}
        {{ product.price | money }}
    {% endif %}
{% endfor %}

 

If helpful then please Like and Accept Solution .
Buy me A Coffee

Whatsapp :- For Shopify Design Changes | Shopify Custom Coding | Custom Modifications


Connect with Us in Our DMs | teampixeledge@gmail.com
Arkligte
Shopify Partner
9 1 1

Hi, thank you for your reply.

 

I applied this code and it doesn't seem to work as expected. Also, the code applies to other collection too, not just "interior".

 

Arkligte_0-1707814523175.png