Cart Note of Graphql Cart API return null

Here, i am sharing my query and api variables but in return i am getting null for the notes, what should i do?

QUERY


mutation {
cartCreate(
input: {
lines: [
{
quantity: 1
merchandiseId: "gid://shopify/ProductVariant/46250296082751"
}
],
buyerIdentity: {
email: "ajeetsh@example.com",
countryCode: CA,
deliveryAddressPreferences: {
deliveryAddress: {
address1: "150 Elgin Street",
address2: "8th Floor",
city: "Ottawa",
province: "Ontario",
country: "CA",
zip: "K2P 1L4"
},
}
}
attributes: {
key: "cart_attribute",
value: "This is a cart attribute",

}
}
) {
cart {
id
createdAt
updatedAt
lines(first: 10) {
edges {
node {
id
merchandise {
... on ProductVariant {
id
}
}
}

}
}
note
buyerIdentity {
deliveryAddressPreferences {
__typename
}
}
attributes {
key
value
}
cost {
totalAmount {
amount
currencyCode
}
subtotalAmount {
amount
currencyCode
}

totalTaxAmount {
amount
currencyCode
}
totalDutyAmount {
amount

}
}
}
}
}

Variables:


{
"cartInput": {
"lines": [
{
"quantity": 1,
"merchandiseId": "gid://shopify/ProductVariant/46250296082751",
"note":"[https://picsum.photos/200](https://picsum.photos/200)"
}
],
"note": "sdsdsadadad",
"attributes": {
"key": "test",
"value": "[https://johns-apparel.myshopify.com](https://johns-apparel.myshopify.com)"

}

}
}

Hi Ajeetesh,

From your query and variables, it appears you are trying to add a note to your cart. However, the note field should be a part of the cart input directly, not inside the line items or attributes.

Update your variables to:

{
  "input": {
    "lines": [
      {
        "quantity": 1,
        "merchandiseId": "gid://shopify/ProductVariant/46250296082751"
      }
    ],
    "buyerIdentity": {
      "email": "ajeetsh@example.com",
      "countryCode": "CA",
      "deliveryAddressPreferences": {
        "deliveryAddress": {
          "address1": "150 Elgin Street",
          "address2": "8th Floor",
          "city": "Ottawa",
          "province": "Ontario",
          "country": "CA",
          "zip": "K2P 1L4"
        }
      }
    },
    "attributes": [
      {
        "key": "cart_attribute",
        "value": "This is a cart attribute"
      }
    ],
    "note": "sdsdsadadad"
  }
}

In this updated version, the note field is added directly within the input object, at the same level as lines, buyerIdentity, and attributes.

Hope this helps!