Products only available to buy when a specific product/collection is in cart

Mads4
Shopify Partner
6 0 0

Hi

How do I make it possible so a product only can be bought when a specific product / collection already is in the cart?

Possible to do it with product tags?
E.g. if product tag "SILVER" is in the cart, you can buy this specific product.

0 Likes
Mads4
Shopify Partner
6 0 0

forgot to mention I am using the Minimal theme

0 Likes
Aleon
Tourist
7 0 1

This is how I did it, if there are products from the following collections, it should show me the buy button, and if there is no one of these collections it should not show me

 

 

<!--Boton Comprar-->
      
        {% for item in cart.items  limit:1%}
               {% assign found_collection = false %}
              {% for collection in item.product.collections %}
                  {% if found_collection == false and collection.title == 'Acabados' or found_collection == false and collection.title == 'Combo' %}
                    {% assign found_collection = true %}
                  {% endif %}
              {% endfor %}

              {% if found_collection %}
                        <input type="submit" name="checkout" value="Comprar ahora" class="btn btn-primary aparece-solamente-ventas"/>
              {% endif %}

         {% endfor %}

 

 

0 Likes