checkoutAttributesUpdateV2 mutation returns checkout not found error

checkoutAttributesUpdateV2 mutation returns checkout not found error

skipper17
Shopify Partner
6 0 3

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"
      }
    ]
  }
}
Replies 4 (4)

skipper17
Shopify Partner
6 0 3

Ive tried coverting the ID to base 64 string but still same error

ShopifyDevSup
Shopify Staff
1453 238 500

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

skipper17
Shopify Partner
6 0 3

Hi @ShopifyDevSup  Ive  tried this but still same error ive even tried this in base64 encoding

zachsitka
Shopify Partner
12 1 2

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.