Hey folks
We’ve hit something with cart validation functions and draft orders and wanted to check whether it’s expected or a gap.
Since validation functions now run when a draft order is completed (via draftOrderComplete, or “Mark as paid” in the admin), we’d love for our validation to read data we store on the draft. But the function’s cart never seems to include the draft order’s metafields, so a metafield-based check can’t pass for any draft.
Where this hurts:
- Merchants completing drafts in the admin are fine. They get the unresolved business rule modal, click “Ignore and create order”, and carry on.
- Apps that create and complete drafts through the Admin API can’t do that. For example, helpdesk apps like Gorgias re-ship an order by duplicating it into a draft and completing it. There’s no API equivalent of the ignore button, so
draftOrderCompletejust returns the validation error and the draft gets stuck. That’s true even when the data the validation needs is already on the draft as a metafield. One merchant ended up with a pile of open re-ship drafts that their team had to find and push through by hand.
How to reproduce (Admin API 2026-07):
- Create a draft with
draftOrderCreateandmetafields: [{namespace: "my_app", key: "selection", type: "json", value: "{…}"}]. The metafield is right there in the response. - Read the draft back. Still there.
- Call
draftOrderComplete(id, paymentPending: true). Our function’s input query asks forcart { metafield(namespace: "my_app", key: "selection") { jsonValue } }, but atbuyerJourney.step: CHECKOUT_COMPLETIONthat field comes through asnull, so the draft stays open with our validation error inuserErrors.
What does work:
- Draft
customAttributesshow up fine throughcart.attribute(key:). - On the draft’s invoice-link checkout, a cart metafield written by a checkout UI extension is visible as you’d expect.
A couple of related things we noticed:
- There’s no documented way for a function to know the cart came from a draft order.
- The draft order → order metafield copy (“Matching draft order definition”) can only be set up in the admin.
MetafieldCapabilitieson 2026-07, 2026-10 and unstable only hascartToOrderCopyable, so apps can’t create that link for merchants.
A few questions:
- Is it intended that draft order metafields aren’t passed to validation functions as cart metafields?
- Could they be exposed (maybe only when a matching draft order definition exists), or could the function input get a documented “this is a draft order” signal?
- Is there, or could there be, a way for an API caller to complete a draft despite a validation error, like the admin’s “Ignore and create order”?
- Is an API for linking draft order and order metafield definitions on the roadmap?
Happy to share more details if that helps. Thanks a lot!