Need help with if... else liquid syntax based on product type.

New Member
9 0 0

NEVER MIND - MY SYNTAX IS CORRECT, ONLY I INITIALLY ADDED IT TO THE INCORRECT DIV. Duh on me. Cannot figure out how to delete the post.


I'm wanting to show something only for a certain "Type" (in CSV columns) of product, namely for rings only (we sell jewelry).

Within the given div's classes, I tried…

{% if product.type == 'rings' %}d-block{% else %}d-none{% endif %}

Doesn't work. Is "Type" not a filter?

I also tried using item.product.type based on a thread I found; doesn't work.

Could someone help me with liquid syntax needed?

Or, show me a different way to show/hide a div based on the product type? 

(In case you're curious, my goal is to show a repeat of availability but only if the product is a ring, because rings have sizes with varying availability, and so I want to repeat the availability next to the size selector menu on ring pages without having this repeat show up on non-ring product pages. I suppose I could do via CSS if I assign a product.type ID per page, but now I'd like to know how to do the if… else way.)

Thanks for reading. Hope you can help!


Shopify Partner
1228 157 217

Hi @PixelRelishDC 

Good day. 

Your snippet is correct. But can you set me as a staff so I can take a look to give you the best solution in this case?

LitExtension - Shopping Cart Migration Expert
If our answer is helpful then please accept as solution!
Are you looking for a solution to migrate to Shopify? Contact us for further assistance.
Try our FREE DEMO now!
New Member
9 0 0

I tried to delete the post but couldn't figure out how to.

I merely was editing the wrong div within my liquid page; duh on me. Yes, everything is working just fine now