In the Comet API, the productFind query provides a powerful way to search for products based on specific criteria. Whether you’re looking for products of a certain type, within a price range, or with a specific name, this query has you covered.

Query

To search for products, use the productFind query:

query SearchProducts($organizationId: ID!, $filters: ProductFindFilters, $pagination: Pagination) {
  productFind(organizationId: $organizationId, filters: $filters, pagination: $pagination) {
    pageInfo {
      startCursor
      endCursor
      hasNextPage
      hasPreviousPage
      totalCount
    }
    nodes {
      id
      name
      type
      # Other product fields as needed
    }
  }
}

Replace $organizationId, $filters, and $pagination with the appropriate values for your search.

Parameters

  • organizationId: The unique identifier for any brand or publisher in the system. This helps in narrowing down the search to products associated with a specific organization.

Filters

The productFind query supports a variety of filters to refine your search:

  • shopSystemEnvironmentId: Filter products based on the shop system environment.
  • name: Search for products with a specific name or name pattern.
  • type: Filter products based on their type.
  • variantOf: Search for products that are variants of a specific product.
  • priceMin: Set a minimum price for the products in your search.
  • priceMax: Set a maximum price for the products in your search.

Pagination

To retrieve products in manageable chunks, use the pagination parameters:

  • first: The number of records to retrieve after the specified cursor.
  • after: The cursor to start retrieving records after.
  • last: The number of records to retrieve before the specified cursor.
  • before: The cursor to start retrieving records before.

If pagination is not provided, the default page size is 10 records. For more details on pagination, refer to the Pagination Documentation.

Product Results

The productFind query returns a ProductConnection type, which includes:

  • pageInfo: Information about the current page of results, including cursors, page indicators, and total count.
  • nodes: A list of products that match the search criteria.

For a more detailed breakdown of the Product type and its associated fields, refer to the Product Schema Documentation.