I want to hide the buy button when I see multiple vendors for an item in my cart

I want to hide the buy button when I see multiple vendors for an item in my cart.

I would like to know how to do the conditional branching.
Is there a good way to do this?

Hi @Anonymous_4d9e7ed625bfa1bbc1782320693c1e6d ,

Please add code like this:

{%- assign check = 1 -%}
{%- assign vendor = ‘’ -%}
{%- for item in cart.items -%}
{%- if vendor != item.vendor -%}
{%- assign vendors = item.vendor -%}
{%- assign check = check | plus : 1 -%}
{%- endif -%}
{%- endfor -%}
{%- if check > 2 -%}

{%- endif -%}

Hope it helps!

If my answer can help you solve your issue, please mark it as a solution. Thank you and good luck

Thanks for your reply!
You have helped me to solve my problem.
I also learned a lot about how to write this kind of code using liquid.
Thank you very much for your help.