Skip to content

Create Draft Cart

Customer-nested Create-Order entry point. Creates an empty admin draft cart (is_active = 0) for the customer and returns its cartId — the integer handle you pass to every cart-keyed write mutation (addItemAdminCart, saveAddressAdminCart, setShippingMethodAdminCart, setPaymentMethodAdminCart, createAdminPlaceOrder) as their cartId input.

Select cartId, not id

This is an action mutation — its result is not an addressable record, so the auto-generated id (IRI) field has no value and selecting it returns Internal server error. Select the result fields instead: cartId, customerId, success, message.

Operation

OperationTypePurpose
createAdminDraftCart(input: createAdminDraftCartInput!)MutationBootstrap a fresh draft cart for a customer

Input

FieldTypeNotes
customerIdInt!The customer the order is being created for.

Distinct from createAdminReorder (which seeds the cart from an existing order's items).

Menu overview

See the Customers overview for how the Create-Order flow fits together.

Errors

GraphQL errors[] causeNotes
Customer not foundReturned for an unknown / 0 customerId
UnauthenticatedMissing admin Bearer token
Draft cart could not be createdBubbles up the underlying error message

Released under the MIT License.