Controlling the logic of the checkout if there is more than products from one collection

I have multiple vendors operating from my site. Each vendor is a ‘collection’. I don’t want to allow a user to check-out if there is products from more than one collection. If that is the case, then i want to disable the checkout button.

Hi @SquareMarket ,

You can use if code to check:

{%- assign check = 0 -%}

{%- assign checkCollection = ‘’ -%}

{%- for item in cart.items -%}

{%- if checkCollection != item.product.collections[0].handle -%}

{%- assign check = check | plus: 1 -%}

{%- assign checkCollection = item.product.collections[0].handle -%}

{%- endif -%}

{%- endfor -%}

{%- if check > 1 -%}

// show button checkout

{%- endif -%}