New Shopify Certification now available: Liquid Storefronts for Theme Developers

Shopify Flow: get customer's last order

Shopify Partner
15 0 4
  • order.customer.lastOrder.shippingAddress.address1 is not returning the last order but rather the customer's first order
  • Get order data (customer_id:{{order.customer.legacyResourceId}} AND created_at:>='{{ "now" | date_minus:"1 day" }}') returns the last X orders, but it includes the order that triggered the flow. This means if 1 order is returned it will be the order that triggered the flow and not the previous order.

If customer.lastOrder doesn't return the last order, and a get order data query includes the order that triggered the flow, how do I get the customer's previous order?


I have tried getting the last 2 orders from a get order data query, but I don't know how to skip the first entry, and I have tried editing the query to change "now" to something like "1 hour" but it doesn't work. Here is the query:


customer_id:{{order.customer.legacyResourceId}} AND created_at:>='{{ "now" | date_minus:"1 day" }}'


If I can get the query to return results that skip the last few minutes up to X days, it should work.

Replies 0 (0)