orders

This component fetches Orders from the CRM, either owned by the logged-in user or for all customer Orders.

{% component type: "orders" %}

Parameters and Options

Parameter Values Required Description
type orders

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

layout <Your Layout name>
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).

currentMemberOnly true (default)
false

By default (true) retrieves orders from the logged in user only. If false retrieves orders for all CRM contacts.
filterBy id (default)
formId
memberId
caseId
name
invoiceNumber
invoiceDate
paymentType
AmountPending
AmountPaid
subTotalPrice
taxPercent
taxPrice
totalPrice

The name of the property to filter by. If empty or not present, no filtering will be used.

Remove spaces from custom property names here.

filterValue <your value>
Your specific value to filter by, eg: name, id, number, date, etc.
Liquid variables can be used here also. If present but no value set, no items will be returned.
sortBy id (default)
formId
memberId
caseId
name
invoiceNumber
invoiceDate
paymentType
AmountPending
AmountPaid
subTotalPrice
taxPercent
taxPrice
totalPrice

The name of the property to sort by. If empty or not present, alpha/numeric sorting will be used.

Remove spaces from custom property names here.

sortOrder ASC
DESC (default)

ASC sorts the items in ascending order while DESC sorts in descending order (based on alpha/numeric or date sorting).
If empty or not present, alpha/numeric sorting will be used.
limit 10 (default)
<number>

The maximum number of items returned (unspecified parameter will show ALL items).
offset 0 (default)
<number>

The number of items skipped before being listed.
object item
collection (default)

Determines the method for Liquid rendering.
item returns each item iteratively, one after another, for output (generally, output to a container element with no need for looping through the data).
collection returns all items as one collection for output (your container element and looping logic would be handled in the Components Layout).
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 has 1 sample items (due to a filter applied) but is otherwise the default structure you will get from this Component.

{
  "items": [
  {
    "paymentType": "CreditCard",
    "state": "Succeed",
    "formId": 13,
    "memberId": 35,
    "caseId": 186,
    "name": "Checkout 12 May 2020 09:01 AM",
    "invoiceNumber": 1,
    "invoiceCode": null,
    "invoiceDate": "2020-05-12T09:01:00.24",
    "amountPending": 0.0000,
    "amountPaid": 12.4800,
    "amountPaidHtml": "<span data-cms_cart_total=\"12877807959236673571\">$12.48</span>",
    "amountPendingHtml": "<span data-cms_cart_total=\"12877807959236673571\">$0.00</span>",
    "id": "12877807959236673571",
    "formatSetting": {
      "name": "Default",
      "culture": "en-US",
      "decimalsQuantity": 2,
      "currency": {
        "code": "USD",
        "symbol": "$",
        "digitalCode": "840",
        "name": "US Dollar"
      }
    },
    "domainCountry": {
      "name": "UNITED STATES",
      "code": "US"
    },
    "destinationCountry": {
      "name": "UNITED STATES",
      "code": "US"
    },
    "shippingOption": {
      "id": "12252410371037462531",
      "shippingOptionId": "7361027874612051969",
      "name": "Local Delivery",
      "price": 10.0000,
      "taxPercent": 4.0000,
      "taxRate": 0.0400,
      "taxPrice": 0.40000000,
      "totalPrice": 10.40000000,
      "subTotalPrice": 10.0000
    },
    "discount": {
      "id": null,
      "code": null,
      "type": null,
      "amount": 0.0
    },
    "giftVoucher": {
      "id": null,
      "code": null,
      "amount": 0.0,
      "balance": 0.0
    },
    "subTotalPrice": 2.0800,
    "taxPercent": 4.0000,
    "taxRate": 0.0400,
    "taxPrice": 0.0800,
    "discountPrice": 0.0000,
    "totalPrice": 12.4800,
    "shippingPrice": 10.0000,
    "shippingTaxRate": 0.0400,
    "shippingTaxPrice": 0.40000000,
    "shippingTotalPrice": 10.40000000,
    "giftVoucherPrice": 0.0000,
    "subTotalTaxPrice": 0.08000000,
    "discountedSubTotalTaxPrice": 0.08000000,
    "grandTotalPrice": 2.16000000,
    "totalPriceExcludingTax": 12.4000,
    "totalPriceExcludingTaxAndGiftVoucherAmount": 12.0800,
    "totalPriceExcludingTaxHtml": "<span data-cms_cart_total_price_excluding_tax=\"12877807959236673571\">$12.40</span>",
    "totalPriceExcludingTaxAndGiftVoucherAmountHtml": "<span data-cms_cart_total_price_excluding_tax_and_gift_voucher_amount=\"12877807959236673571\">$12.08</span>",
    "grandTotalPriceHtml": "<span data-cms_cart_grand_total_price=\"12877807959236673571\">$2.16</span>",
    "discountPriceHtml": "<span data-cms_cart_discount_price=\"12877807959236673571\">$0.00</span>",
    "discountedSubTotalTaxPriceHtml": "<span data-cms_cart_discounted_sub_total_tax_price=\"12877807959236673571\">$0.08</span>",
    "subTotalTaxPriceHtml": "<span data-cms_cart_subtotal_tax_price=\"12877807959236673571\">$0.08</span>",
    "taxPriceHtml": "<span data-cms_cart_tax_price=\"12877807959236673571\">$0.08</span>",
    "shippingTotalPriceHtml": "<span data-cms_cart_shipping_total_price=\"12877807959236673571\">$10.40</span>",
    "shippingPriceHtml": "<span data-cms_cart_shipping_price=\"12877807959236673571\">$10.00</span>",
    "shippingTaxPriceHtml": "<span data-cms_cart_shipping_tax_price=\"12877807959236673571\">$0.40</span>",
    "shippingTaxPercentHtml": "<span data-cms_cart_shipping_tax_percent=\"12877807959236673571\">4.0000%</span>",
    "taxPercentHtml": "<span data-cms_cart_tax_percent=\"12877807959236673571\">4.0000%</span>",
    "giftVoucherPriceHtml": "<span data-cms_cart_gift_voucher_price=\"12877807959236673571\">$0.00</span>",
    "totalPriceHtml": "<span data-cms_cart_total=\"12877807959236673571\">$12.48</span>",
    "items": [
      {
        "id": "15049017874163171329",
        "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": 0.0000,
        "taxPercent": 4.0000,
        "unitPrice": 2.0000,
        "taxPrice": 0.08000000,
        "unitTotalPrice": 2.08000000,
        "totalPrice": 2.08000000,
        "unitTaxPrice": 0.08000000,
        "taxRate": 0.0400,
        "totalPriceExcludingTax": 2.0000,
        "taxPercentHtml": "<span data-cms_cart_item_tax_percent=\"15049017874163171329\">4.0000%</span>",
        "totalPriceExcludingTaxHtml": "<span data-cms_cart_item_total_without_tax=\"15049017874163171329\">$2.00</span>",
        "unitTaxPriceHtml": "<span data-cms_cart_item_unit_tax=\"15049017874163171329\">$0.08</span>",
        "unitTotalPriceHtml": "<span data-cms_cart_item_total_unit_price=\"15049017874163171329\">$2.08</span>",
        "unitPriceHtmlTotal": "<span data-cms_cart_item_total_unit_price=\"15049017874163171329\">$2.08</span>",
        "priceHtml": "<span data-cms_cart_item_price=\"15049017874163171329\">$0.00</span>",
        "unitPriceHtml": "<span data-cms_cart_item_subtotal_price=\"15049017874163171329\">$2.00</span>",
        "taxPriceHtml": "<span data-cms_cart_item_tax=\"15049017874163171329\">$0.08</span>",
        "totalHtmlPrice": "<span data-cms_cart_item_total_price=\"15049017874163171329\">$2.08</span>",
        "totalPriceHtml": "<span data-cms_cart_item_total_price=\"15049017874163171329\">$2.08</span>",
        "quantityHtml": "<input type=\"number\" value=\"1\" data-cms_cart_item_quantity=\"15049017874163171329\" />",
        "removeHtml": "<a href=\"javascript:\" data-cms_cart_remove_order_line=\"15049017874163171329\"><svg xmlns=\"http://www.w3.org/2000/svg\" 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": "12550665647534637058",
            "name": "Size",
            "attributeType": "0",
            "valueType": "FixedPrice",
            "options": [
              {
                "id": "749807479205920772",
                "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
          }
        ]
      }
    ],
    "subTotalPriceHtml": "<span data-cms_cart_subtotal=\"12877807959236673571\">$2.08</span>"
  }
]
}

Virtual Layout

Based on the above example, if not using any custom layout or collection, the default virtual layout will output as a summary list of orders, eg:

<ul>
    {% for order in this.items %}
        <li> 
            <strong>{{order .name}}</strong>    
            <span>Invoice Date: {{order.invoiceDate | format_date: "dddd, MMMM dd, yyyy"}}</span>  
            <span>Total Cost: {{order.totalPrice | set_money_format : order.domainCountryCode,  order.formatSettingId}}</span>
        </li>
    {% endfor %}
</ul>

Rendering the list:

  • Checkout 12 May 2020 09:01 AM Invoice Date: Tuesday, May 12, 2020 Total Cost: $12.48

Accessing the Data

This data is also accessible directly on the Page or Template via a Liquid Collection by adding collectionVariable to the Component.

An example using collectionVariable with value "allorders":

{% component type: "orders", collectionVariable: "allorders" %}

Accessing a specific item within the collection. In this case the first item (zero based index), which in our example would render the value Checkout 12 May 2020 09:01 AM

{{allorders.items[0]['name']}}


Related Articles

  • Form Submissions
  • {{ workflow }} object
    This liquid object will output the Workflow details of a submitted Form. You can use...
  • cases
    This component fetches Cases from the CRM, either owned by the logged-in user or for all customer Cases.

External Resources

There are currently no external resources available.

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


Questions?

We are always happy to help with any questions you may have.
Send us a message at support@treepl.co and we will consult you as soon as possible.