What's your biggest current challenge? Have your say in Community Polls along the right column.

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

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 7 (7)

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

sgr
Excursionist
25 1 10

Hi Armin,

 

I tried to implement your template in a flow internal email but I get the following error:

 

 

"order" is invalid. Replace this variable.

 

Have you had to edit this template since implementing it?

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
1439 157 333

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.
sgr
Excursionist
25 1 10

Hi Paul, 


I'm trying to implement the template used by the op but I get the following error message:

 

 

This is the code I'm using in my internal email that's working:

 

 

{% for lineItems_item in fulfillmentOrder.lineItems %}
{{lineItems_item.totalQuantity}}
{% endfor %}

{% for lineItems_item in fulfillmentOrder.order.lineItems %}
{% for variants_item in lineItems_item.product.variants %}
{{variants_item.barcode}}
{% endfor %}
{% endfor %}

 

I would like to have the quantity of each line item listed next to the barcode of the line item the quantity refers to. Is this possible? At the  moment the quantity sits above the barcodes so it's not clear as to which barcode/line item the quantity is referring to.

paul_n
Shopify Staff
1439 157 333

The main issue here is that the API doesn't have a way to get to the product information from the fulfillment order line items. That is being added in a future version, but isn't available yet.

 

Short term, you could try to merge the lists using Run code, which is way better at list handling than liquid. But it requires using JavaScript.

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.