A space to discuss GraphQL queries, mutations, troubleshooting, throttling, and best practices.
We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more
I am trying to use discountCodeBxgyCreate mutation and I am using the following structure;
customerGets {
value {
... on DiscountOnQuantity {
effect {
... on DiscountPercentage {
percentage
}
... on DiscountAmount {
amount {
amount
currencyCode
}
appliesOnEachItem
}
}
quantity {
quantity
}
}
}
and the following variables;
{
discountOnQuantity:
{
quantity: "1010",
effect: {
amount: "50.00"
}
}
}
which is the same one Shopify itself uses when you try to create the same discount on standard Shopify discounts. However, I get the following error:
Error: Variable $bxgyCodeDiscount of type DiscountCodeBxgyInput! was provided invalid value for customerGets.value.discountOnQuantity.effect.amount (Field is not defined on DiscountEffectInput)
However, the documentation claims that DiscountEffect's possible types are DiscountAmount and DiscountPercentage.
Solved! Go to the solution
This is an accepted solution.
It sounds like there's a mismatch between your GraphQL mutation structure and the expected input for the `discountCodeBxgyCreate` mutation in the Shopify Admin API.
Here's would you can try:
Hope this helps,
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
This is an accepted solution.
It sounds like there's a mismatch between your GraphQL mutation structure and the expected input for the `discountCodeBxgyCreate` mutation in the Shopify Admin API.
Here's would you can try:
Hope this helps,
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