Have your say in Community Polls: What was/is your greatest motivation to start your own business?

Re: Getting order details from the order before last order

Solved

Getting order details from the order before last order

Pandur
Tourist
14 0 3

Hello, I am trying to create an automation where customers who placed two or more orders in the past 3 hours would receive a notification. I would like to also let the customer know which are those two specific orders, say #1002 and #1001. My issue is that the last order will always be the triggering order. Thus:

 

{%- for getOrderData_item in getOrderData -%}
{{- getOrderData_item.name -}}
{%- endfor -%}

 

won't work, as it would return #1002 (from our example). Any ideas how I can reference the order from before last order?

Accepted Solution (1)
paul_n
Shopify Staff
1433 157 332

This is an accepted solution.

Maybe this?

{%- for getOrderData_item in getOrderData -%}
{{- getOrderData_item.name }}{% if forloop.first %} and {% endif -%}
{%- endfor -%}

 

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.

View solution in original post

Replies 3 (3)

paul_n
Shopify Staff
1433 157 332

I don't think this is an issue. The get order data will return both orders

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.
Pandur
Tourist
14 0 3

That's true. However, it will always return both orders. What I was trying to achieve is to use them separately as values. For example, the desired result should be:

 

"Your last two orders are #1001 and #1002."

 

Currently it's returning: "#1001#1002"

paul_n
Shopify Staff
1433 157 332

This is an accepted solution.

Maybe this?

{%- for getOrderData_item in getOrderData -%}
{{- getOrderData_item.name }}{% if forloop.first %} and {% endif -%}
{%- endfor -%}

 

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.