Conflict when updating minimum purchase requirement

promotion_addic
Shopify Partner
1 0 0

Hi,

I am working on creating and updating promotions via the graphql APIs

 

https://shopify.dev/docs/api/admin-graphql/2023-10/mutations/discountCodeBasicUpdate

 

At first, I created a promotion with minimum purchase requirement as amount and this worked. Now, when I try to update the promotion to minimum quantity of items, I am getting a graph ql error

 

 

 {"Code": "CONFLICT", "Message": "Minimum quantity cannot be defined when minimum subtotal is.",

 

 

 

...............    
"minimumRequirement": { "quantity": { "greaterThanOrEqualToQuantity": "10" }, "subtotal": { "greaterThanOrEqualToSubtotal": null } },
................

 

 

In the update payload, I am setting greaterThanOrEqualToSubtotal to null but it doesnt seem to work.

Please let me know if I am missing something,. Thanks

 

 

Reply 1 (1)

Liam
Shopify Staff
2731 299 769

If the API does not support changing the requirement type directly in a single update due to conflicts - you could consider using two mutations. The first mutation would remove the existing subtotal requirement (potentially by setting it to an invalid or empty state that the API accepts as "removal"), and the second mutation would then add the quantity requirement.

 

Would this work for you?

Liam | Developer Advocate @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog