A space to discuss GraphQL queries, mutations, troubleshooting, throttling, and best practices.
Hey guys,
We're using the GraphQL API to add free products to some orders post-purchase:
mutation beginEdit( $orderId: ID! ){ orderEditBegin(id: $orderId){ calculatedOrder{ id } } }
Followed by:
mutation addVariantToOrderAndCommit( $calculatedOrderId: ID! $variantId: ID! $quantity: Int! $allowDuplicates: Boolean ){ orderEditAddVariant(id: $calculatedOrderId, variantId: $variantId, quantity: $quantity, allowDuplicates: $allowDuplicates){ calculatedOrder { id addedLineItems(first:5) { edges { node { id quantity } } } } userErrors { field message } } }
We're POSTing this to the /admin/api/2021-10/graphql.json endpoint.
The item gets added correctly to an order, HOWEVER, the call creates and the item gets added into a new fulfilment, rather than into the existing fulfilment, which causes major problems for our dispatch team (as the items are small enough to send out in a single fulfilment, and our shipping label mechanism goes into sensory overload)
Once an order is edited, we see the following in the order management screen:
Some additional points which may be of importance here:
Has anyone experienced this before or know a way to combine fulfilments?
Thanks,
Ryan