1
votes

I'm trying to create a new product variant with API. The new variant will include the total price and weight of several variants. The format is attached

enter image description here

You can see that the buy 4 vans is the new variant. When the order is paid, the variants included are added as free items. I tried to add with orderEditAddVariant and then orderEditAddLineItemDiscount with the new Order Edit API.

It's working well until someone tries to buy one of the items separately. The order edit cannot commit. Afer orderEditAddVariant, it gives an error and stop here.

after addVariantsToOrder: result =

{'data': {'orderEditAddVariant': {'calculatedOrder': None, 'userErrors': [{'field': ['id'], 'message': "VANS | ERA 59 (DESERT COWBOY) - 9 / light_brown was not added because it's already o n the order."}]}}, 'extensions': {'cost': {'requestedQueryCost': 16, 'actualQueryCost': 10, 'throttleStatus': {'maximumAvailable': 1000.0, 'currentlyAvailable': 90, 'restoreRate': 50.0}}}}

How can I resolve this? Did anyone try to fix it?

I also try to open a thread on Shopify community & ask the Partner support but have no luck

When I added the item manually in Shopify admin - Order Edit, I can successfully add the item. Theeefore, I don't know why it's not permitted in the GraphQL admin API.

enter image description here

enter image description here

1

1 Answers

1
votes

It was my mistake. From the doc, just add allowDuplicates: true and the edit will be permitted.