<p>Well depends exactly what you want to do, but something along these lines...</p>
<pre><code>{% set cart = craft.commerce.carts.cart %}

{% for lineItem in cart.lineItems %}
   {% if lineItem.purchasable.product.type == &quot;whatever&quot; %}
       {# item of that type found...redirect the user #} 
       {% redirect 'somewhere' %}
   {% endif %}
{% endfor %}

{# item of that type not found... #}
{% redirect 'elsewhere' %} 
...or your default stuff directly here...

</code></pre>

CC BY-SA 4.0
2021-11-12T05:33:41.437Z
2021-11-12T05:33:41.437Z
Jeremy Daalder
<p>I would like to redirect users to an additional page in my checkout flow if they have a particular product type in their cart. Does anyone know how I can do that?</p>

<plugin-craftcommerce>
Check if product type is in user's cart
# Check if product type is in user's cart

(Asked by: username_0 on 2021-11-11)

I would like to redirect users to an additional page in my checkout flow if they have a particular product type in their cart. Does anyone know how I can do that?

**Tags:** plugin-craftcommerce

---

## 1 answers

### Answer by username_1 on 2021-11-12. Score: 2 | Accepted answer

Well depends exactly what you want to do, but something along these lines...
{% set cart = craft.commerce.carts.cart %}

{% for lineItem in cart.lineItems %}
   {% if lineItem.purchasable.product.type == "whatever" %}
       {# item of that type found...redirect the user #} 
       {% redirect 'somewhere' %}
   {% endif %}
{% endfor %}

{# item of that type not found... #}
{% redirect 'elsewhere' %} 
...or your default stuff directly here...


---

