Show information in cart if cart contains a product with a certain type

New Member
1 0 0

I am trying to add certain text to the cart page, if the customer has a product in their cart with a specific product type. What am I missing?

 

{% for item in cart.items %}
                      {% if item.product.type == 'Corporate Meals' %}
                     
        <p>Some text for corporate</p>
        {% endif %}
                    
{% endfor %}
                     
 
{% endfor %}
0 Likes
Shopify Staff
Shopify Staff
723 40 103

Hi, @michellepaulhus !

 

Katy here from Shopify. I hope all is well with you, and indeed welcome to our Community here!

 

It does appear that you have an additional {% endfor %} tag added here. (I am not sure if this is a typo ?) Otherwise however, it looks good! I do have some additional questions which may help: 

 

  • Have you added this to the cart-template.liquid file? This would be the best place to customize the cart page.
  • Also, I know this may seem like an obvious question, but have you ensured to apply the correct 'type' to the relevant products in the admin > products section of your admin? We have a guide to help apply this in bulk here.

Once you have ensured the above, I would suggest to clear your cache.  After doing so if you still don't notice any changes, if you could then share a link to your store here that would be great.


Cheers,
Katy

Katy | Social Care @ Shopify
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog

0 Likes