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:
- The order is paid but always unfulfilled when we send the API call
- All items in the original order (pre-API-edit) are on SubscriptionContracts with SellingPlans
- We’re using Bold Subscriptions to manage subscriptions
- We’re adding a standard product variant to the order, not a special “free gift” product - the product has a shipping weight and normal price, which we 100% discount.
- We have a “Subscriptions” delivery profile, set up via the GraphQL API, which is only applicable to products on SellingPlans
Has anyone experienced this before or know a way to combine fulfilments?
Thanks,
Ryan
