Add a class to product page if the product has variants or doesn't have variants (Debut Theme)

Solved
Highlighted
New Member
3 0 0

Hi everyone,

I was hoping someone can help me. I wanted to add a class to the product page if the product has variants.

The reason being is I want to be able to target on mobile, to hide the images thumbnails and show the variants thumbnails instead, 
while if the product doesn't have variants, I want to show the product thumbnails.

Any help would be greatly appreciated.

 

 

0 Likes
Highlighted
Shopify Partner
276 28 53

This is an accepted solution.

Hi, You can add this condition in class

{% if product.variants.size > 1 %} your-class-for-variants{% endif %}

Capture.JPG 

If helpful then please Like and Accept Solution.
Email: suhagiyajivan1992@gmail.com
Skype: jivan.suhagiya
Give a try to Shopify APP: https://apps.shopify.com/short-track
0 Likes
Highlighted
New Member
3 0 0

This worked like Magic! Thank you so much!

0 Likes