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 -%}
Are you ready to take your business to the next level? Look no further than the latest ...
By SarahF_Shopify Apr 15, 2024We’re keeping the ball rolling to make sure you’re always ahead of the game. So buckle ...
By JasonH Apr 8, 2024Portrait of Stephen positioned next to an image of planet Earth, with the Stephen's World ...
By JasonH Mar 18, 2024