Discussing Shopify Functions development, deployment, and usage in Shopify apps.
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.
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
Hi, there
cart input object does't have field called customerFirstOrder
Try this for your function input :
{
cart: {
attribute(key:"customersFirstOrder")
.......
}