Skip to content

Get Products

About

The getProducts query retrieves a paginated list of products from your store with support for advanced sorting and filtering. This query is essential for:

  • Building product catalog browsing interfaces
  • Implementing product search, sorting, and filtering experiences
  • Creating product recommendation systems
  • Syncing product data with external systems

The query supports cursor-based pagination to efficiently handle large product catalogs and includes metadata for:

  • Basic product information (name, SKU, description, vendor)
  • Pricing and inventory details
  • Product images and media
  • Categories, tags, and custom attributes
  • Publication and availability status
  • Created and updated timestamps

Arguments

ArgumentTypeDescription
firstIntThe number of products to return per page (max: 250). Used for forward pagination.
afterStringThe cursor of the product to start after. Used with first for pagination.
lastIntThe number of products to return in reverse (max: 250). Used for backward pagination.
beforeStringThe cursor to start before. Used with last for reverse pagination.
sortKeyProductSortKeysField to sort by: TITLE, PRICE, CREATED_AT, UPDATED_AT. Default: TITLE
reverseBooleanReverse the sort order. Default: false
queryStringSearch query string for filtering products. Supports advanced search syntax.

Possible Returns

FieldTypeDescription
edges[ProductEdge!]!Array of edges containing products and cursors. Each edge represents a connection between nodes.
edges.nodeProduct!The actual product object containing id, name, sku, price, and other product fields.
edges.cursorString!Pagination cursor for this product. Use with after or before arguments.
nodes[Product!]!Flattened array of products without edge information.
pageInfoPageInfo!Pagination metadata object.
pageInfo.hasNextPageBoolean!Whether there are more products after the current page.
pageInfo.hasPreviousPageBoolean!Whether there are products before the current page.
pageInfo.startCursorStringCursor of the first product on the current page.
pageInfo.endCursorStringCursor of the last product on the current page.
totalCountInt!Total number of products matching the query criteria.

Released under the MIT License.