Hello,
We are trying to prevent customer from checking out based on conflicting Items.
For example, we only want sell items A and B together, and can’t be sold separated.
People are able to get through validation in our JS files with the checkout URL.
Is there a way for us to prevent that from happening?
Hi @Jeff1843 ,
At the cart page, you need to check that it has both items displayed, if it is, you will show the checkout button. https://i.imgur.com/F7cWBmj.png
{% assign pro_a = 0 %}
{% assign pro_b = 0 %}
{%- for item in cart.items -%}
{% if item.product.handle == ‘handle product A’ %}
{% assign pro_a = 1 %}
{% endif %}
{% if item.product.handle == ‘handle product B’ %}
{% assign pro_b = 1 %}
{% endif %}
{%- endfor -%}
{% assign check = pro_a | plus: pro_b %}
{% if check == 2 %}
show button
{% endif %}
Hope it helps!