Dedicated to the Hydrogen framework, headless commerce, and building custom storefronts using the Storefront API.
Iam trying to update the custom attributes when a checkout is created right now i have subscribed to a checkout/create web-hook so that every time checkout is created i will be able to push the custom attributes using storefront graphql API but below mutation throws checkout not found error even though it is a valid checkout ID
mutation checkoutAttributesUpdateV2($checkoutId: ID!, $input: CheckoutAttributesUpdateV2Input!) {
checkoutAttributesUpdateV2(checkoutId: $checkoutId, input: $input) {
checkout {
id
}
checkoutUserErrors {
field
code
message
}
}
}
{ "checkoutId": "gid://shopify/Checkout/36603304411456", "input": { "allowPartialAddresses": true, "customAttributes": [ { "key": "_testAttribute", "value": "testing" } ] } }
Ive tried coverting the ID to base 64 string but still same error
Hi @skipper17 👋
The `checkoutAttributesUpdateV2` mutation generally expects a checkout ID with the format `gid://shopify/Checkout/{...}key={...}` as demonstrated in this guide.
Hope that helps!
Developer Support @ Shopify
- Was this reply helpful? Click Like to let us 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
Hi @ShopifyDevSup Ive tried this but still same error ive even tried this in base64 encoding
I was getting this same error because the key parameter on my checkout id was changing faster than I was keeping it up to date in state. You could try making sure that the key is accurate and the latest version.