get_order_status
Check the status of a placed order by order ID to track shipping and delivery progress for purchased hats.
Instructions
Check the status of a placed order by order ID.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| order_id | Yes | Order ID returned from place_order |
Implementation Reference
- main.py:432-463 (handler)The handler function 'get_order_status' retrieves order status from Shopify and attempts to fetch tracking information from Printful.
@app.post("/tools/get_order_status") async def get_order_status(request: Request): body = await request.json() order_id = body.get("order_id") data = await shopify_get(f"orders/{order_id}.json") order = data["order"] # Try Printful printful_data = None async with httpx.AsyncClient(timeout=10) as client: pf = await client.get(f"{PRINTFUL_BASE}/orders/@{order_id}", headers=PRINTFUL_HEADERS) if pf.status_code == 200: pf_result = pf.json().get("result", {}) shipments = pf_result.get("shipments", []) printful_data = { "status": pf_result.get("status"), "tracking": { "carrier": shipments[0].get("carrier") if shipments else None, "tracking_number": shipments[0].get("tracking_number") if shipments else None, "tracking_url": shipments[0].get("tracking_url") if shipments else None, } if shipments else None, } return { "order_id": str(order["id"]), "order_number": order.get("order_number"), "financial_status": order.get("financial_status"), "fulfillment_status": order.get("fulfillment_status") or "unfulfilled", "created_at": order.get("created_at"), "printful": printful_data, }