Skip to main content
Glama

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
NameRequiredDescriptionDefault
order_idYesOrder 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,
        }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/masonicGIT/shop-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server