d
Topic
Posts:
5
5 months ago

How to filter cart items based on Type This post is outdated

Hello,

I have some products available for pre-order, and I need to add a checbox to the cart so that when somebody orders a pre-order product, they are forced to acknowledge the ship date. I've done this in the past with just one product, and used the following snippet:

 

                                {% for product in cart.items %}
{% if product.title == 'Queen' %}          
                    <div class="qoh-checkbox cart__footer__text">
  <input type="checkbox" id="agree" />
  <label for="agree">
    <strong>I understand that pre-orders will not ship until July 27th, subject to change.</strong>
  </label>
            </div>
    {% endif %}
          {% endfor %}
 

This time, I'm having trouble because I have multiple products, I created a new product type for these products (VIP), and am trying to use it to filter, but I must be doing it wrong:

 

                                {% for product in cart.items %}
{% if product.type == 'VIP' %}          
                    <div class="qoh-checkbox cart__footer__text">
  <input type="checkbox" id="agree" />
  <label for="agree">
    <strong>I understand that pre-orders will not ship until July 27th, subject to change.</strong>
  </label>
            </div>
    {% endif %}
          {% endfor %}
 

Can anybody help me? I can't use SKUS as there are too many, and I can't use tags as I show those on the front-end of my site. I could use collection but I'm not sure how to do that.