New Shopify Certification now available: Liquid Storefronts for Theme Developers

Properly formated, order triggered email including all products + variants + SKUs ...

RennWelten
Excursionist
29 3 4

Hi everyone,

 

I'm pretty now to Flow, been playing around with it abit and like it alot already. Now I am trying to set something up that seems a bit tricky.

 

When ever an order is created I need to send out internal emails that include basicly almost everything that the client also receives by the "normal" order confirmation mail.

 

  • Clients name
  • Clients email adress
  • Ordered product(s)
  • Variant(s) off all ordered products
  • SKUs off all ordered products
  • Price off all ordered products
  • Discount used
  • Total Price of the order
  • Note content for the order
  • Link to the order within Shopify backend

Especially the loop for the ordered products is being some sort of a pain + the fact it's kinda hard to find the suiting variables.

 

My email template content so far looks like this:

 

Client: {{order.billingAddress.firstName}} {{order.billingAddress.lastName}}
Email: {{order.customer.email}}

Order summary:
{% for lineItems_item in order.lineItems %}
Quantity: {{lineItems_item.quantity}}
Product: {{lineItems_item.title}}
Variant: {{lineItems_item.variantTitle}}
SKU: {{lineItems_item.sku}}
Unit Price: {{order.currencyCode}} {{lineItems_item.originalUnitPriceSet.shopMoney.amount}}
{% endfor %}

Discount used: {{order.discountCode}}
Total Price: € {{order.currentTotalPriceSet.shopMoney.amount}}
Note: {{order.note}}

Shipping adress:
{{order.shippingAddress.address1}}
{{order.shippingAddress.zip}}
{{order.shippingAddress.city}}
{{order.shippingAddress.country}}

Order Link: https://{{shop.myshopifyDomain}}/admin/orders/{{order.legacyResourceId}}

I guess my idea is so tricky as it should cover orders including

  • Single product
  • Single product with several variants of it
  • Serveral Products
  • Serveral product with several variants of it

 

Any help would be highly appreciated!

 

Kindest regards!

 

Armin

Replies 4 (4)
RennWelten
Excursionist
29 3 4

Aaalright, the results already look pretty good, at least most of the required data is included in the mail. BUT: The formatting of the mail is a mess. Most variables are just aligned after each other in one single line. 

 

Adding <br> after each variable within the loop solved that

RennWelten
Excursionist
29 3 4

Okay, the next challenge:

 

Our shop is set up so clients can combine discount codes. But my email template only shows one (the first) of the two discounts I used in the testing orders .

RennWelten
Excursionist
29 3 4

Looks like flow only supports one discount code at the moment, right?

paul_n
Shopify Staff
Shopify Staff
606 97 155

In the latest version of the API, there is a new field to more easily support showing lists of discounts codes (since that was made possible recently). Flow will upgrade to the API version in next couple of months. In the meantime, you may have luck using the list in order.discountApplications. You would have to loop over it in liquid like lineItems. One limitation is that I don't believe it would show you the code used (but the discount actually applied).

Paul_N | Flow Product Manager @ Shopify
- Finding Flow useful? Leave us a review
- Need Flow help? Check out our help docs.
- Building for Flow? Check out Flow's dev docs.