Skip to content

Reorder

Build a fresh admin draft cart from a previous order's items — the same flow as the Reorder button on the admin order-view screen.

Operation

OperationTypePurpose
createAdminReorderMutationCreate a draft cart from a past order

Input

FieldTypeNotes
orderIdID!The order's resource IRI — "/api/admin/orders/{id}".

Why orderId, not id? API Platform GraphQL reserves id as the resource IRI, so a mutation input field named id collides. We use orderId for the order reference.

Behaviour

This is the same action as the admin Reorder button:

  1. A new draft admin cart is created for the order's customer (not the customer's own active cart).
  2. Every item from the order is re-added to that draft cart. Per-item failures are swallowed.
  3. Returns success, message, and the new cartId.

Errors

The mutation enforces the same 3-check guard as the admin panel. Each failure returns the errors[] array (the data.createAdminReorder payload is null) with a distinct message per failure mode:

Conditionerrors[0].message
Order was placed as guest (is_guest = 1)Reorder is not supported for guest orders.
At least one item's product is no longer purchasableOne or more items in this order are no longer available for purchase.
Admin's role lacks sales.orders.createYou do not have permission to create orders.
sales.order_settings.reorder.admin config is offReorder by admin is disabled in store settings.

Sample error response

json
{
  "errors": [
    {
      "message": "Reorder is not supported for guest orders.",
      "extensions": { "category": "invalid_input" }
    }
  ],
  "data": { "createAdminReorder": null }
}

Released under the MIT License.