Have your say in Community Polls: What was/is your greatest motivation to start your own business?
Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Cart attribute value from the "input.graphql" returns NULL in a "cart checkout validation" function.

Solved

Cart attribute value from the "input.graphql" returns NULL in a "cart checkout validation" function.

slasw7
Shopify Partner
13 0 1

Hi, I'm having problem retrieving cart attribute value from the "input.graphql" in a "cart checkout validation" function.

 

My site is using the new checkout system and I developed a custom extension-only app for customizing it.

 

There are several extensions in the app. One of the extension is a "cart checkout validation" function.I find that it the cart attributes in the input.graphql are all returning null value. It was working fine (has value) until yesterday.

 and I'm not sure why:

 

Some observations:

1. I am very sure I did not touch the code and the same piece of code was returning values before.
2. After checkout, I checked that the order indeed has all of the cart attributes in the order details in admin panel.

3. Other extension types (e.g. "delivery_customization", "ui_extension") in the same app are using the same cart attributes just fine.
4. I created another "cart checkout validation", it cannot get the cart attributes also.

5. I tried disabling/enabling the checkout rule and even reinstalled the whole app, but it does not help.

 

It seems to me that only the cart attributes in the "cart checkout validation" input are not returning value.

 

The extension is on api_version = "2023-07".

My input.graphql:

 

query Input {
  localization {
    language {
      isoCode
    }
  }
  buyerJourney {
    step
  }
  cart {
    attrAddressType: attribute(key: "address_type") {
      value
    }
    attrAddressPrefill: attribute(key: "address_prefill") {
      value
    }
    deliveryGroups {
      deliveryAddress {
        address1
        city
        provinceCode
        countryCode
        zip
      }
    }
  }
}

In the function:

 

 

 

const addressType = input.cart.attrAddressType?.value; // Returns NULL
const addressPrefill = input.cart.addressPrefill?.value; // Returns NULL

 

 

 

 

Accepted Solution (1)

Liam
Community Manager
3108 344 889

This is an accepted solution.

Hi folks! 

 

Our team shipped a fix for this recently so you shouldn't be seeing this error moving forward. Please let us know if any of your stores are experiencing this.

 

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

View solution in original post

Replies 13 (13)

st-kietvo
Shopify Partner
4 0 1

We have same issue, that work fine until yesterday. Today, I got null 😳

vy2902
Shopify Partner
26 0 0

i had the same problem.

But it seems like Shopify don't support this problem.

nhtbao101
Tourist
14 0 1

I have the same problem with it. Maybe it just happened recently

Liam
Community Manager
3108 344 889

Hi folks,

 

Will investigate this issue today to see if there's been a change on our side that has caused this. I'll report back asap!

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

slasw7
Shopify Partner
13 0 1

Hi @Liam 

Any updates?

Can you confirm the issue lies on Shopify's end or not?

Sorry for urging, but this function is crucial in my site's checkout logic. 

Liam
Community Manager
3108 344 889

Hi Slasw7 - it does appear the issue is on Shopify's side. Our developers are looking into a fix at the moment. 

 

Appreciate your patience here!

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

nhtbao101
Tourist
14 0 1

This problem just happened 7-8 days ago. But in this morning, I rechecked and it came back, and now it's working. I don't know why, maybe Shopify just updated something?

slasw7
Shopify Partner
13 0 1

Thanks for your information @nhtbao101 , I turned the function on just now and it came back too.

Liam
Community Manager
3108 344 889

This is an accepted solution.

Hi folks! 

 

Our team shipped a fix for this recently so you shouldn't be seeing this error moving forward. Please let us know if any of your stores are experiencing this.

 

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

slasw7
Shopify Partner
13 0 1

Thanks Liam, it's working like a charm.

Trushal
Shopify Partner
3 0 0

Hello Liam,

 

i've the same issue in my store which is based on Checkout and Customer Accounts Extensibility  and we want to develop a delivery customisation function based on the cart attribute.

 

 

 

 

query RunInput {
  cart {
    handles: attribute(key: "hideHanldes"){
      value
    }
  }
}

 

 

 

we are passing the the handle in the cart attribute with key hideHandles .

the output of the function is

 

 

 

{
  "cart": {
    "handles": {
      "value": "list of the hideble handles"
    }
  }
}

 

 

 

 

but when we want to get the details of the handles value is returns null

 

const hideHandles = input.cart.handles?.value; || returns null

salonia
Shopify Partner
1 0 2

Hi @Liam,

 

We are still experiencing the same issue with the Cart checkout validation API despite using the latest API version, 2024-01.

Could you please help us investigate why this is happening?

neonninja
Shopify Partner
1 0 1

We are still facing this issue for the last couple of days. Any one else facing the problem now