Ad

Field 'product' Is Missing Required Arguments: Id

- 1 answer

I am learning in here.

The code look like below

product(first:3){
    edges {
      node {
        id
        handle
        variants(first:3) {
          edges {
            node {
              id
              displayName
            }
          }
        }
      }
    }
  }

will give me

"errors": [
    {
      "message": "Field 'product' is missing required arguments: id",
      "locations": [
        {
          "line": 2,
          "column": 1
        }
       ]
       ....
    }
]

Any clue why is require id? Normally it should return 3 first product with their 3 variants. And also there is another message "Field 'product' doesn't accept argument 'first'"??

Ad

Answer

Try using type name "products" instead of "product".

Query should be like this:

product(first:3){
    edges {
      node {
        id
        handle
        variants(first:3) {
          edges {
            node {
              id
              displayName
            }
          }
        }
      }
    }
  }
Ad
source: stackoverflow.com
Ad