Hi i try to use the checkoutGiftCardRemoveV2 mutation
the idea is to remove gift card with balance from the cart/checkout.
Problems
-
documentation don’t provide examples of the right variables to use (both values are general copy paste )
-
when trying to discover the value for the checkoutID is the most likely place where is have the issue
debugging
trying to call checkoutGiftCardRemoveV2 payload is
query: `
mutation checkoutGiftCardRemoveV2($appliedGiftCardId: ID!, $checkoutId: ID!) {
checkoutGiftCardRemoveV2(appliedGiftCardId: $appliedGiftCardId, checkoutId: $checkoutId) {
userErrors
{
message
field
}
checkout {
id
}
checkoutUserErrors {
message
field
}
}
}
`,
variables: {
checkoutId: "gid://shopify/Checkout/Z2NwLXYYYYYYYYYYYYYYS0hR",
appliedGiftCardId: "gid://shopify/GiftCard/542910644449"
},
this call was send to the
/api/2024-04/graphql.json
where the gift card Id was checked by the call
query: `
query {
giftCard(id: "gid://shopify/GiftCard/542910644449") {
balance {
amount
currencyCode
}
}
}
`,
send to endpoint of
/admin/api/2024-04/graphql.json
and this give us response of
{ giftCard: { balance: { amount: '2.0', currencyCode: 'GBP' } } }
so now the issue is most likely in the value of
checkoutId
I have webhooks for the cart create/modify and the webhooks for the checkout create/modify the value down there was taken form the “cart_token” property from the JSON output.
So can I know what should be the right value / format of the checkoutId value
Thank you paddy