GitHub

ShopifyQueryRoot

Type

import { ShopifyQueryRoot } from '@daffodil/driver/shopify'

The entry point for all Storefront API queries. Provides access to shop resources including products, collections, carts, and customer data, as well as content like articles and pages. This query acts as the public, top-level type from which all queries must start.

Use individual queries like product or collection to fetch specific resources by ID or handle. Use plural queries like products or collections to retrieve paginated lists with optional filtering and sorting. The search and predictiveSearch queries enable storefront search functionality.

Explore queries interactively with the GraphiQL explorer and sample query kit.

interface ShopifyQueryRoot {
  __typename: "QueryRoot"
  article: ShopifyArticle
  articles: ShopifyArticleConnection
  blog: ShopifyBlog
  blogByHandle: ShopifyBlog
  blogs: ShopifyBlogConnection
  cart: ShopifyCart
  cartCompletionAttempt: ShopifyCartCompletionAttemptResult
  collection: ShopifyCollection
  collectionByHandle: ShopifyCollection
  collections: ShopifyCollectionConnection
  customer: ShopifyCustomer
  localization: ShopifyLocalization
  locations: ShopifyLocationConnection
  menu: ShopifyMenu
  metaobject: ShopifyMetaobject
  metaobjects: ShopifyMetaobjectConnection
  node: ShopifyNode
  nodes: ShopifyNode[]
  page: ShopifyPage
  pageByHandle: ShopifyPage
  pages: ShopifyPageConnection
  paymentSettings: ShopifyPaymentSettings
  predictiveSearch: ShopifyPredictiveSearchResult
  product: ShopifyProduct
  productByHandle: ShopifyProduct
  productRecommendations: ShopifyProduct[]
  productTags: ShopifyStringConnection
  productTypes: ShopifyStringConnection
  products: ShopifyProductConnection
  publicApiVersions: ShopifyApiVersion[]
  search: ShopifySearchResultItemConnection
  shop: ShopifyShop
  sitemap: ShopifySitemap
  urlRedirects: ShopifyUrlRedirectConnection
}

Properties

__typename
"QueryRoot"
article
ShopifyArticle

Returns an Article by its ID. Each article belongs to a Blog and includes content in both plain text and HTML formats, ArticleAuthor information, Comment objects, tags, and SEO data.

articles
ShopifyArticleConnection

Returns a paginated list of Article objects from the shop's Blog objects. Each article is a blog post containing content, author information, tags, and optional images.

Use the query argument to filter results by author, blog title, tags, or date fields. Sort results using the sortKey argument and reverse them with the reverse argument.

blog
ShopifyBlog

Retrieves a Blog by its handle or ID. A blog organizes Article objects for the online store and includes author information, SEO settings, and custom Metafield objects.

blogByHandle
ShopifyBlog

Retrieves a Blog by its handle. A blog organizes Article objects for the online store and includes author information, SEO settings, and custom Metafield objects.

blogs
ShopifyBlogConnection

Returns a paginated list of the shop's Blog objects. Each blog serves as a container for Article objects.

cart
ShopifyCart

Returns a Cart by its ID. The cart contains the merchandise lines a buyer intends to purchase, along with estimated costs, applied discounts, gift cards, and delivery options.

Use the checkoutUrl field to redirect buyers to Shopify's web checkout when they're ready to complete their purchase. For more information, refer to Manage a cart with the Storefront API.

cartCompletionAttempt
ShopifyCartCompletionAttemptResult

A poll for the status of the cart checkout completion and order creation.

collection
ShopifyCollection

Retrieves a single Collection by its ID or handle. Use the products field to access items in the collection.

collectionByHandle
ShopifyCollection

Retrieves a Collection by its URL-friendly handle. Handles are automatically generated from collection titles but merchants can customize them.

collections
ShopifyCollectionConnection

Returns a paginated list of the shop's collections. Each Collection object includes a nested connection to its products.

customer
ShopifyCustomer

Retrieves the Customer associated with the provided access token. Use the customerAccessTokenCreate mutation to obtain an access token using legacy customer account authentication (email and password).

The returned customer includes data such as contact information, addresses, orders, and custom data associated with the customer.

localization
ShopifyLocalization

Returns the shop's localization settings. Use this query to build country and language selectors for your storefront.

The country and language fields reflect the active localized experience. To change the context, use the @inContext directive with your desired country or language code.

locations
ShopifyLocationConnection

Returns shop locations that support in-store pickup. Use the near argument with GeoCoordinateInput to sort results by proximity to the customer's location.

When sorting by distance, set sortKey to DISTANCE and provide coordinates using the near argument.

Learn more about supporting local pickup on storefronts.

menu
ShopifyMenu

Retrieves a Menu by its handle. Menus are hierarchical navigation structures that merchants configure for their storefront, such as header and footer navigation.

Each menu contains MenuItem objects that can nest up to three levels deep, with each item linking to collections, products, pages, blogs, or external URLs.

metaobject
ShopifyMetaobject

Retrieves a single Metaobject by either its global ID or its handle.

Note: When using the handle, you must also provide the metaobject type because handles are only unique within a type.

metaobjects
ShopifyMetaobjectConnection

Returns a paginated list of Metaobject entries for a specific type. Metaobjects are custom data structures that extend Shopify's data model with merchant-defined or app-defined content like size charts, product highlights, or custom sections.

The required type argument specifies which metaobject type to retrieve. You can sort results by id or updated_at using the sortKey argument.

node
ShopifyNode

Retrieves any object that implements the Node interface by its globally-unique ID. Use inline fragments to access type-specific fields on the returned object.

This query follows the Relay specification and is commonly used for refetching objects when you have their ID but need updated data.

nodes
ShopifyNode[]

Retrieves multiple objects by their global IDs in a single request. Any object that implements the Node interface can be fetched, including products, collections, and pages.

Use inline fragments to access type-specific fields on the returned objects. The input accepts up to 250 IDs.

page
ShopifyPage

Retrieves a Page by its handle or id. Pages are static content pages that merchants display outside their product catalog, such as "About Us," "Contact," or policy pages.

The returned page includes information such as the HTML body content, SEO information, and any associated Metafield objects.

pageByHandle
ShopifyPage

Retrieves a Page by its handle.

pages
ShopifyPageConnection

Returns a paginated list of the shop's content pages. Pages are custom HTML content like "About Us", "Contact", or policy information that merchants display outside their product catalog.

paymentSettings
ShopifyPaymentSettings

Settings related to payments.

predictiveSearch
ShopifyPredictiveSearchResult

Returns suggested results as customers type in a search field, enabling type-ahead search experiences. The query matches products, collections, pages, and articles based on partial search terms, and also provides search query suggestions to help customers refine their search.

You can filter results by resource type and limit the quantity. The limitScope argument controls whether limits apply across all result types or per type. Use unavailableProducts to control how out-of-stock products appear in results.

product
ShopifyProduct

Retrieves a single Product by its ID or handle. Use this query to build product detail pages, access variant and pricing information, or fetch product media and metafields. See some examples of querying products.

productByHandle
ShopifyProduct

Retrieves a Product by its handle. The handle is a URL-friendly identifier that's automatically generated from the product's title. If no product exists with the specified handle, returns null.

productRecommendations
ShopifyProduct[]

Returns recommended products for a given product, identified by either ID or handle. Use the intent argument to control the recommendation strategy.

Shopify auto-generates related recommendations based on sales data, product descriptions, and collection relationships. Complementary recommendations require manual configuration through the Shopify Search & Discovery app. Returns up to ten Product objects.

productTags
ShopifyStringConnection

Returns a paginated list of all tags that have been added to products in the shop. Useful for building tag-based product filtering or navigation in a storefront.

productTypes
ShopifyStringConnection

Returns a list of product types from the shop's Product objects that are published to your app. Use this query to build filtering interfaces or navigation menus based on product categorization.

products
ShopifyProductConnection

Returns a paginated list of the shop's products.

For full-text storefront search, use the search query instead.

publicApiVersions
ShopifyApiVersion[]

Returns all public Storefront API versions, including supported, release candidate, and unstable versions.

search
ShopifySearchResultItemConnection

Returns paginated search results for Product, Page, and Article resources based on a query string. Results are sorted by relevance by default.

The response includes the total result count and available product filters for building faceted search interfaces. Use the prefix argument to enable partial word matching on the last search term, allowing queries like "winter snow" to match "snowboard" or "snowshoe".

shop
ShopifyShop

Returns the Shop associated with the storefront access token. The Shop object provides general store information such as the shop name, description, and primary domain.

Use this query to access data like store policies, PaymentSettings, Brand configuration, and shipping destinations. It also exposes ShopPayInstallmentsPricing and SocialLoginProvider options for customer accounts.

sitemap
ShopifySitemap

Returns sitemap data for a specific resource type, enabling headless storefronts to generate XML sitemaps for search engine optimization. The query provides a page count and paginated access to resources like Product, Collection, Page, and Blog objects.

When paginating through resources, the number of items per page varies from 0 to 250, and empty pages can occur without indicating the end of results. Always check hasNextPage to determine if more pages are available.

urlRedirects
ShopifyUrlRedirectConnection

Returns a paginated list of UrlRedirect objects configured for the shop. Each redirect maps an old path to a target location.