Skip to main content
All CollectionsContentCart layout
Add a limited cart total to your cart layout
Add a limited cart total to your cart layout

Only show your customers the total number of products in their cart and exclude abandoned products.

Updated over 6 months ago

If you are limiting the number of products in your cart layout, (for example, to only show three), but the customer has abandoned more than that number then the cart total will not equal the total products you are showing them.


Add a limited cart total

To total the products shown in your cart layout:

  1. Go to Content > Cart Layout.

  2. Create a new cart layout or edit an existing one.

  3. Insert the following code in the Edit the Cart Layout field before the product For loop:

    {% set cart_total = [] %}
  4. Insert this code inside the For loop:

    {% if cart_total.append((product.uv*product.qty)) %}{% endif %}
  5. Insert this code after in order to show the total:

    {{ cart_total|sum|format_currency(cart.curr) }}
  6. Select SAVE.

Example

You should end up with something like this:

{% set cart_total = [] %}

{% for product in products|limit(max_products_to_show) %}
{% if cart_total.append((product.uv*product.qty)) %}{% endif %}
{% endfor %}

{{ cart_total|sum|format_currency(cart.curr) }}

This is a basic example that excludes most of the code you would use to display product details.

Did this answer your question?