shipping/order discount function return null on any attribute

shipping/order discount function return null on any attribute

abidhasan
Shopify Partner
7 0 0

I am updating my cart attributes using,

fetch('/cart/update.js', {
  method: 'post',
  headers: {
    'content-type': 'application/json'
  },
  body: JSON.stringify({
    line: 1,
    attributes: {
        customersFirstOrder: 'false'
    }
  })
})

And when I fetch `cart.js` I see the attribute is there. But Shopify Function returns null on function input,

{
  "cart": {
    "customersFirstOrder": null,
    "deliveryGroups": [
      {
        "id": "gid://shopify/CartDeliveryGroup/0",
        "deliveryOptions": [
          {
            "code": "Standard"
          },
        ]
      }
    ]
  }
}

I check on two apps, one is published and another one is in development. I also checked in it on multiple stores. Is it a Shopify problem, or they changed something? It was working perfectly fine.

 

Replies 2 (2)

Liam
Community Manager
3108 340 871

Do you think you could be hitting one of these limitations on input queries? https://shopify.dev/docs/apps/build/functions/input-output#limitations

 

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

Eric-HAN
Shopify Partner
181 25 20

Hi, there

 

cart input object does't have field called  customerFirstOrder

Try this  for your function input :

{
  cart: {
    attribute(key:"customersFirstOrder")
    .......
    
}

 

 

 

- Helpful? Please hit Like and mark it as a solution
Want to modify or custom changes on store? Let me help.
- Feel free to Email Me    Buy Me A Coffee