How to see how many collections are in a cart?

SquareMarket
Tourist
7 0 0

I would like to disable my checkout button if there is products from more than 1 collection in the cart.

this is a pseudo code of what I am looking for, but i couldn't find out you specifically count the number of collections in a cart. I am not very proficient with liquid, and despite using https://www.shopify.ca/partners/shopify-cheat-sheet I could not figure it out

I want to: 

- create variable for Set of the collections

- iterate through the items in the cart

-add the collection of the item to the Set

-If there is >1 collection in the set, disable the button

0 Likes