When I use the mutation cartCreate to update the lines of the cart I receive the error below regarding the "merchandiseId" that I’m passing, except that the ID is actually the correct one since I also use them to fetch products.
As I saw in the documentation:
Ex. gid://shopify/Product/10079785100
I don’t even know if it’s actually the “merchandiseId” or some other one as it’s not specified by the error response.
The GraphQL request:
mutation cartCreate($input: CartInput!, $country: CountryCode = ZZ, $language: LanguageCode) @inContext(country: $country, language: $language) {
cartCreate(input: $input) {
cart {
...CartApiMutation
checkoutUrl
}
userErrors {
...CartApiError
}
}
}
fragment CartApiMutation on Cart {
id
totalQuantity
}
fragment CartApiError on CartUserError {
message
field
code
}
The variables:
{
"input": {
"lines": [
{
"merchandiseId": "gid://shopify/Product/<something>"
}
],
"buyerIdentity": {}
},
"country": "US",
"language": "EN"
}
The error that I receive:
{
"data": {
"cartCreate": null
},
"errors": [
{
"message": "invalid id",
"path": [
"cartCreate"
],
"locations": []
}
],
"extensions": {
"context": {
"country": "US",
"language": "EN"
}
}
}