Prerequisites

Introduction

You can now add details of a customer's eCommerce Order to Workflow and Autoresponder transactional emails.

Give your Client and the customer peace of mind, as well as valuable records for their safekeeping.

eCommerce Orders are created by Checkout and Quote-only Forms. 

Within the email, you can also access any fields that were submitted along with the original Form. Learn more here: Dynamic Content in Workflow and Autoresponder Emails

Syntax

Add the following Liquid tag to include the details of the customer's most recent Order. 

{% include 'ecommerce/order_details', layout: 'email' %}


In an email notification, this will always be based on the Form that triggered the email. Only an Order generated by that Form submission will be visible in this context. This means that Autoresponder emails will always show Form Submission data from the correct User. 

Layouts

File Structure

You can use an existing Layout, or create a new one in this File Structure:

layouts/modules/module_14/order/my_layout/

Within your Layout folder, you'll need:

  • An item.liquid and a wrapper.liquid file

Developing the Layout

Inside your email notification file, you'll have access to the Form object:

{{form.properties}}

This contains the fields submitted with the Form. Learn more here: Dynamic Content in Workflow and Autoresponder Emails

You'll still have access to these fields throughout the Order Details Layouts.

Inside your  order_details  Layout you'll find an item.liquid and wrapper.liquid file.

Wrapper

You can use the wrapper.liquid file to build the main HTML structure of your Layout. When you're ready to include the Order Details, use the following Liquid to include the item.liquid file:

{%- include 'modules/siteglide_ecommerce/ecommerce/get/get_order_details', item_layout: 'item' -%}

Item

The item.liquid file will have access to the This object, which will contain details about the Order:

{{this}}

Orders involve several different types of models and can be complex. When developing you will need to use loops to take into account each different eCommerce element which may be a part of the Order.

When developing a custom Layout, it may be helpful to refer to the default Layout.

Looping over Products


This loop will find any Products in the Order and loop over them.

{%- for product in this.order_products -%}
    <!-- Output {{product}} -->
{% endfor %}

Looping over Products and accessing Fields

Within a Product Loop, you can access the fields associated with that Product.

  • {{ product.product_name }} 
  • {{ product.quantity }}
  • {{ product.product_code }}
  • {{ product.currency_symbol }}
  • {{ product.price }}

Looping over Products, then looping over Attributes

{%- for product in this.order_products -%}
    <!-- Output {{product}} -->
    {% for attribute in product.order_product_attributes -%}
         <!-- Output {{attribute }} -->
    {% endfor %}
{% endfor %}

Outputting Shipping Method

The following fields are available relating to the Shipping Method:

  • this['Shipping Method Name']
  • this['Currency Symbol']
  • this['Shipping Method Price']
  • {%- include 'modules/siteglide_ecommerce/ecommerce/price_formatter', price_data: this['Shipping Method Price'] -%} - a formatted Shipping Price

Example of only including Shipping Information if it was set:

{% if this['Shipping Method Name'] != blank %}
     {{this['Shipping Method Name']}}
     {{ this['Currency Symbol'] }}
     {%- include 'modules/siteglide_ecommerce/ecommerce/price_formatter', price_data: this['Shipping Method Price'] -%}
{% endif %}

Outputting Totals

  • {{ this['Currency Symbol'] }}
  • this['Total Price']
  • {%- include 'modules/siteglide_ecommerce/ecommerce/price_formatter', price_data: this['Total Price'] -%} - A formatted total price

Did this answer your question?