Using two different cart templates

Tourist
15 0 1

Hi,

I'm trying to use different cart templates for different user flows scenarios (for example, adding a section if the origin page is from a specific page).

When editing my shop's code, I was able to create a new template but unlike regular pages / collection pages which you can choose which template to use for the cart this option isn't available. 

Any thoughts?

 

0 Likes
Shopify Partner
1156 133 203

It's theme specific, but usually, you'd have an if conditional in your templates/cart.liquid file that would include a specific template based on some logic. Something like this (inside templates/cart.liquid):

{% if <some condition> %}
  {% section 'cart-template-one' %}
{% else %}
  {% section 'cart-template-two' %}
{% endif %}
Sergiu Svinarciuc | CTO @ visely.io
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution!
- To learn more about the awesome stuff we do head over to visely.io or our blog
0 Likes