shopify_get_customer_orders
Retrieve a Shopify customer's orders by email address.
shopify_get_customer_orders(context: dict, email: str) -> list[dict]Retrieves all orders for a Shopify customer by email, including fulfillment details, line items, pricing, and addresses. Returns an empty list if no orders are found.
Requires the Shopify integration to be installed for the business.
Parameters
| Name | Type | Description |
|---|---|---|
context | dict | The context object passed to your action |
email | str | The customer's email address |
Returns
list[dict] — A list of order objects with fulfillment details, line items, pricing, addresses, etc. Returns an empty list if no orders are found.
Examples
Look up recent orders for a customer
def execute_action(context):
email = context["args"]["email"]
orders = shopify_get_customer_orders(context, email)
if not orders:
return {"found": False, "message": "No orders found for this email."}
return {
"found": True,
"orderCount": len(orders),
"orders": [
{
"id": o["id"],
"name": o["name"],
"totalPrice": o["totalPrice"],
"fulfillmentStatus": o.get("fulfillmentStatus"),
}
for o in orders
],
}Check if a specific order belongs to the customer
def execute_action(context):
email = context["args"]["email"]
order_name = context["args"]["orderName"]
orders = shopify_get_customer_orders(context, email)
match = next((o for o in orders if o["name"] == order_name), None)
if match is None:
return {"error": f"Order {order_name} not found for this customer."}
return {"order": match}