Liquid, JavaScript, themes, sales channels
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 -%}
Portrait of Stephen positioned next to an image of planet Earth, with the Stephen's World ...
By JasonH Mar 18, 2024Digital marketers and app developers have tracked activity in apps and websites for yea...
By Ollie Mar 13, 2024February was an exciting month with Shopify Editions, informative webinars, and more! F...
By JasonH Mar 7, 2024