This component fetches data relating to the shopping cart, such as any products added, order totals, tax, shipping, etc.

It's primarily used to render a shopping cart summary throughout the site and the shopping cart layout.

{% component type:"shopping_cart" %}

Parameters and Options

Parameter Values Required Description
type shopping_cart

This is the name of the entity that needs to be used for the component retrieving function.

layout <path/to/layout>
Path to file that will contain the Liquid layout content to be parsed.

If an empty string, nothing will be rendered.
If paramater is not included, the default virtual layout will be rendered (see below).

collectionVariable <yourLiquidVariableName>
Assigns the data to a Liquid collection enabling further access to the data on the Page or Template using Liquid.

Your collectionVariable value must only contain English letters, numbers or underscores. Spaces or special characters are not supported.

Liquid Output

The below example shows the Liquid data output from this component (for example, when using a collectionVariable to create the collection):

    "totalItemsCount": "1",
    "hasGiftVoucherProducts": "False",
    "taxCodeId": "",
    "unitsCountHtml": "<span data-cms_cart_units_count=\"1907185188476027100\">1</span>",
    "checkoutButtonHtml": "<button class=\"system_button\" data-cms_cart_checkout=\"\">checkout</button>",
    "clearCartHtml": "<button class=\"system_button\" data-cms_cart_clear_card=\"\">Clear cart</button>",
    "giftVoucherHtml": "<input type=\"text\" data-cms_cart_gift_voucher=\"\" value=\"\" />",
    "discountCodeHtml": "<input type=\"text\" data-cms_cart_discount_code=\"\" value=\"\" />",
    "id": "1907185188476027100",
    "paymentIntentId": "",
    "paymentIntentClientSecret": "",
    "formatSetting": {
        "name": "AU",
        "culture": null,
        "decimalsQuantity": 0,
        "currency": {
            "code": "AUD",
            "symbol": "$",
            "digitalCode": "36",
            "name": "Australian Dollar"
    "domainCountry": {
        "name": "AUSTRALIA",
        "code": "AU"
    "destinationCountry": {
        "name": "AUSTRALIA",
        "code": "AU"
    "shippingOption": {
        "id": null,
        "shippingOptionId": null,
        "name": null,
        "price": 0.0,
        "taxPercent": 0.0,
        "taxRate": 0.0,
        "taxPrice": 0.0,
        "totalPrice": 0.0,
        "subTotalPrice": 0.0
    "discount": {
        "id": null,
        "code": null,
        "type": null,
        "amount": 0.0
    "giftVoucher": {
        "id": null,
        "code": null,
        "amount": 0.0,
        "balance": 0.0
    "subTotalPrice": "41.9500",
    "taxPercent": "0",
    "taxRate": "0",
    "taxPrice": "1.6780",
    "discountPrice": "0.0000",
    "totalPrice": "43.6280",
    "shippingPrice": "0",
    "shippingTaxRate": "0",
    "shippingTaxPrice": "0",
    "shippingTotalPrice": "0",
    "giftVoucherPrice": "0.0000",
    "subTotalTaxPrice": "1.67800000",
    "discountedSubTotalTaxPrice": "1.67800000",
    "grandTotalPrice": "43.62800000",
    "totalPriceExcludingTax": "41.9500",
    "totalPriceExcludingTaxAndGiftVoucherAmount": "41.9500",
    "totalPriceExcludingTaxHtml": "<span data-cms_cart_total_price_excluding_tax=\"1907185188476027100\">$41.95</span>",
    "totalPriceExcludingTaxAndGiftVoucherAmountHtml": "<span data-cms_cart_total_price_excluding_tax_and_gift_voucher_amount=\"1907185188476027100\">$41.95</span>",
    "grandTotalPriceHtml": "<span data-cms_cart_grand_total_price=\"1907185188476027100\">$43.63</span>",
    "discountPriceHtml": "<span data-cms_cart_discount_price=\"1907185188476027100\">$0.00</span>",
    "discountedSubTotalTaxPriceHtml": "<span data-cms_cart_discounted_sub_total_tax_price=\"1907185188476027100\">$1.68</span>",
    "subTotalTaxPriceHtml": "<span data-cms_cart_subtotal_tax_price=\"1907185188476027100\">$1.68</span>",
    "taxPriceHtml": "<span data-cms_cart_tax_price=\"1907185188476027100\">$1.68</span>",
    "shippingTotalPriceHtml": "<span data-cms_cart_shipping_total_price=\"1907185188476027100\">$0.00</span>",
    "shippingPriceHtml": "<span data-cms_cart_shipping_price=\"1907185188476027100\">$0.00</span>",
    "shippingTaxPriceHtml": "<span data-cms_cart_shipping_tax_price=\"1907185188476027100\">$0.00</span>",
    "shippingTaxPercentHtml": "<span data-cms_cart_shipping_tax_percent=\"1907185188476027100\">0%</span>",
    "taxPercentHtml": "<span data-cms_cart_tax_percent=\"1907185188476027100\">0%</span>",
    "giftVoucherPriceHtml": "<span data-cms_cart_gift_voucher_price=\"1907185188476027100\">$0.00</span>",
    "totalPriceHtml": "<span data-cms_cart_total=\"1907185188476027100\">$43.63</span>",
    "items": [
            "id": "15049017874163171330",
            "ecommerceItemId": 2535,
            "smallImage": "/images/template-detail-dinewine-mobile@2x.png",
            "name": "DEMO Product 1",
            "type": "ModuleItem",
            "moduleId": 0,
            "SKUCode": "DEMO1",
            "quantity": 1,
            "productFileLink": null,
            "Url": "/catalogs/demo-product-1",
            "price": 39.9500,
            "taxPercent": 4.0000,
            "unitPrice": 41.9500,
            "taxPrice": 1.67800000,
            "unitTotalPrice": 43.62800000,
            "totalPrice": 43.62800000,
            "unitTaxPrice": 1.67800000,
            "taxRate": 0.0400,
            "totalPriceExcludingTax": 41.9500,
            "taxPercentHtml": "<span data-cms_cart_item_tax_percent=\"15049017874163171330\">4.0000%</span>",
            "totalPriceExcludingTaxHtml": "<span data-cms_cart_item_total_without_tax=\"15049017874163171330\">$41.95</span>",
            "unitTaxPriceHtml": "<span data-cms_cart_item_unit_tax=\"15049017874163171330\">$1.68</span>",
            "unitTotalPriceHtml": "<span data-cms_cart_item_total_unit_price=\"15049017874163171330\">$43.63</span>",
            "unitPriceHtmlTotal": "<span data-cms_cart_item_total_unit_price=\"15049017874163171330\">$43.63</span>",
            "priceHtml": "<span data-cms_cart_item_price=\"15049017874163171330\">$39.95</span>",
            "unitPriceHtml": "<span data-cms_cart_item_subtotal_price=\"15049017874163171330\">$41.95</span>",
            "taxPriceHtml": "<span data-cms_cart_item_tax=\"15049017874163171330\">$1.68</span>",
            "totalHtmlPrice": "<span data-cms_cart_item_total_price=\"15049017874163171330\">$43.63</span>",
            "totalPriceHtml": "<span data-cms_cart_item_total_price=\"15049017874163171330\">$43.63</span>",
            "quantityHtml": "<input type=\"number\" value=\"1\" data-cms_cart_item_quantity=\"15049017874163171330\" />",
            "removeHtml": "<a href=\"javascript:\" data-cms_cart_remove_order_line=\"15049017874163171330\"><svg xmlns=\"\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path d=\"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z\" /><path d=\"M0 0h24v24H0z\" fill=\"none\" /></svg></a>",
            "attributes": [
                    "id": "12550665647534637059",
                    "name": "Size",
                    "attributeType": "0",
                    "valueType": "FixedPrice",
                    "options": [
                            "id": "749807479205920773",
                            "name": "Medium",
                            "price": 2.0000,
                            "taxPercent": 4.0000,
                            "taxPrice": 8.00000000,
                            "image": "/images/template-crafter@2x.jpg",
                            "totalPrice": 10.00000000
                    "subTotalPrice": 2.0000,
                    "taxPercent": 4.0000,
                    "taxPrice": 8.00000000,
                    "price": 2.0000,
                    "totalPrice": 10.00000000
            "id": "15049017874163171331",
            "ecommerceItemId": 2536,
            "smallImage": "/images/template-detail-crafter-mobile@2x.png",
            "name": "DEMO product 2",
            "type": "ModuleItem",
            "moduleId": 0,
            "SKUCode": "DEMO2",
            "quantity": 1,
            "productFileLink": null,
            "Url": "/catalogs/demo-product-2",
            "price": 0.0000,
            "taxPercent": 0.0000,
            "unitPrice": 0.0000,
            "taxPrice": 0.00000000,
            "unitTotalPrice": 0.00000000,
            "totalPrice": 0.00000000,
            "unitTaxPrice": 0.00000000,
            "taxRate": 0.0000,
            "totalPriceExcludingTax": 0.0000,
            "taxPercentHtml": "<span data-cms_cart_item_tax_percent=\"15049017874163171331\">0.0000%</span>",
            "totalPriceExcludingTaxHtml": "<span data-cms_cart_item_total_without_tax=\"15049017874163171331\">$0.00</span>",
            "unitTaxPriceHtml": "<span data-cms_cart_item_unit_tax=\"15049017874163171331\">$0.00</span>",
            "unitTotalPriceHtml": "<span data-cms_cart_item_total_unit_price=\"15049017874163171331\">$0.00</span>",
            "unitPriceHtmlTotal": "<span data-cms_cart_item_total_unit_price=\"15049017874163171331\">$0.00</span>",
            "priceHtml": "<span data-cms_cart_item_price=\"15049017874163171331\">$0.00</span>",
            "unitPriceHtml": "<span data-cms_cart_item_subtotal_price=\"15049017874163171331\">$0.00</span>",
            "taxPriceHtml": "<span data-cms_cart_item_tax=\"15049017874163171331\">$0.00</span>",
            "totalHtmlPrice": "<span data-cms_cart_item_total_price=\"15049017874163171331\">$0.00</span>",
            "totalPriceHtml": "<span data-cms_cart_item_total_price=\"15049017874163171331\">$0.00</span>",
            "quantityHtml": "<input type=\"number\" value=\"1\" data-cms_cart_item_quantity=\"15049017874163171331\" />",
            "removeHtml": "<a href=\"javascript:\" data-cms_cart_remove_order_line=\"15049017874163171331\"><svg xmlns=\"\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\"><path d=\"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z\" /><path d=\"M0 0h24v24H0z\" fill=\"none\" /></svg></a>",
            "attributes": []
    "subTotalPriceHtml": "<span data-cms_cart_subtotal=\"1907185188476027100\">$41.95</span>"

Virtual Layout

Based on the above example, if not using any custom layout or collection, the default virtual layout will output as follows:

<div class="shoppingCartWidget" data-ecommerce_shopping_cart_widget>
    {% if this.totalItemsCount > 0 %}
    {{this.totalItemsCount}} item(s), Total: {{this.totalPrice | domain_money_format }} <a class="shoppingCartLink" href="/shopping_cart">View Cart</a>
    {% else %}
    Shopping cart is empty.
    {% endif %}

Accessing the Data

This data is accessible in two main ways:

1. Using Liquid in a custom defined Layout via the this object (for the cart properties) and a forloop on the this.items object (for the cart products).

{% component type: "shopping_cart", layout: "/snippets/" %}

Example of the custom layout file

<h4>Your Cart Summary</h4>
<p>You have {{this.totalItemsCount}} item(s), with a total price of {{this.totalPrice | domain_money_format }}</p>
{% if totalItemsCount > 0 %}
<p><b>Products include:</b></p>
    {% for p in this.items %}
    {% endif %}
<a class="shoppingCartLink" href="/shopping_cart">Review</a>
{% endif %}

2. Directly on the Page or Template via a Liquid Collection if collectionVariable was added to the Component.

An example using collectionVariable with value "cartCollection":

{% component type: "shopping_cart", collectionVariable: "cartCollection" %}

Using the following forloop directly on the page:

    {% for p in this.items %}
    {% endif %}

Renders all the item names in a list:

  • Product Name 1
  • Product Name 2

Accessing a specific item within the collection. In this case the first item (zero based index), which in our example would render the value Product Name 1


Related Articles

  • Domains
    The Treepl CMS Domain settings allow you to control default domain, landing pages, domain authentication for system emails along with country and cultural settings like number and currency formatting.
  • Payment Settings
  • Orders
  • Advanced CRM Groups
  • {{ order }} object
    This liquid object will output the order details of a submitted payment. {% capture data...
  • module (Catalogs)
    This module component fetches data relating to eCommerce Catalogs and can be used to render Catalog structures and Products within them.
  • module (Products)
    This module component fetches data relating to eCommerce Products and can be used to render Product information.
  • ecommerce_add_to_cart
    This component renders an anchor element allowing the javascript function to add the item to the shopping cart.
  • ecommerce_buy_now
    This component renders an anchor element allowing the javascript function to add the item to the shopping cart and then proceeding directly to the shopping cart page.
  • ecommerce_item_quantity
    This component renders a form input element allowing a quantity to be set for when the source item is added to the shopping cart.
  • item_attributes
    This component fetches all attributes/options for a specified product. By default, each attribute group is rendered, with its options and any prices, according to their specified form inputs.
  • related_items
    This component fetches related items of a specific source item, such as a Product that has had Related Products assign to it.
  • grouped_items
    This component fetches grouped items of a specific source item, such as a Product that has been Grouped with other Products and allows the ability to navigate between grouped items.
  • currencies
    This component renders a form select element of all currency names, codes and symbols by default, and can also be used to output currency data to a Liquid collection.
  • shipping_options
    This component renders a form select element of all shipping options configured on the site, and can also be used to output shipping option data to a Liquid collection.
  • shippingProvidesFields
  • tax_codes
    This component renders a form select element of all tax codes configured on the site, and can also be used to output tax code data to a Liquid collection.
  • payment_form_fields
    This component is used to render payment fields, and payment related validation errors, within a form using the capabilities provided by your configured payment gateway.
  • orders
    This component fetches Orders from the CRM, either owned by the logged-in user or for all customer Orders.
  • Getting Started
    With the recent release of eCommerce features there are some advanced system components that are...
  • Products
    Products are one of the most powerful and flexible modules in Treepl CMS. Create customised product schemas with multiple price points, catalogs, inventory tracked attributes/variables, SEO optimisation and more.
  • Catalogs
    When organising any eCommerce store, Catalogs are crucial to your Products structure and browserbility. Easily create and customise unlimited product catalogs for your online store.
  • Discount codes
    Provide discount code functionality for your Treepl CMS shopping cart. Ideal for promotions, customer loyalty and conversions or to help move more stock.
  • Gift vouchers
    Gift vouchers can be issued to your customers or purchased by them online via the shopping cart.
  • Taxes
    Create any number of required tax codes specific to the shipping country selected in your Treepl CMS shopping cart.
  • countries
    This component renders a form select element of all country names and country codes by default, and can also be used to output country codes/names to a Liquid collection.
  • domain_settings
    This module component retrieves settings associated with the current domain, or optionally from another specified domain configured in the site instance.
  • Shipping options
    Treepl CMS provides the ability to configure custom shipping options based on a variety of conditions during the shopping cart stage.
  • Settings
  • Migrating to Advanced Payment Flow
    This article describes differences and possible required actions for migrating to the Advanced Payment Gateway flow.

External Resources

Please let us know if you have any other contributions or know of any helpful resources you'd like to see added here.


We are always happy to help with any questions you may have.
Visit the Treepl Forum for community support and to search previously asked questions or send us a message at and we will consult you as soon as possible.