Answers.Body: <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>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-11-12T05:33:41.437Z
Answers.LastActivityDate: 2021-11-12T05:33:41.437Z
Answers.UserDisplayName: Jeremy Daalder
Body: <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>
  
Tags: <plugin-craftcommerce>
Title: Check if product type is in user's cart
ThreadText: # 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...
  
  ```
  
  
  ---
  
  