products
Returns a list of products.
ProductConnection arguments
- Anchor to afterafter•
The elements that come after the specified cursor.
- Anchor to beforebefore•
The elements that come before the specified cursor.
- Anchor to firstfirst•
The first
n
elements from the paginated list.- Anchor to lastlast•
The last
n
elements from the paginated list.- Anchor to queryquery•
A filter made up of terms, connectives, modifiers, and comparators. You can apply one or more filters to a query. Learn more about Shopify API search syntax.
- Anchor to default•string
Filter by a case-insensitive search of multiple fields in a document.
query=Bob Norman
query=title:green hoodie
- Anchor to bundles•boolean
Filter by a product bundle. A product bundle is a set of two or more related products, which are commonly offered at a discount.
bundles:true
- Anchor to error_feedback•string
Filter by products with publishing errors.
- Anchor to handle•string
Filter by a comma-separated list of product handles.
handle:the-minimal-snowboard
- Anchor to has_only_default_variant•boolean
Filter by products that have only a default variant. A default variant is the only variant if no other variants are specified.
- Anchor to has_variant_with_components•boolean
Filter by products that have variants with associated components.
- Anchor to out_of_stock_somewhere•boolean
Filter by products that are out of stock in at least one location.
- Anchor to product_publication_status•string
Filter by the publishable status of the resource on a channel, such as the online store. The value is a composite of the channel
app
ID (Channel.app.id
) and one of the valid values.- Anchor to publishable_status•string
Filter by the publishable status of the resource on a channel, such as the online store. The value is a composite of either the channel
app
ID (Channel.app.id
) or channelname
and one of the valid values.- Anchor to published_status•string
Filter by the published status of the resource on a channel, such as the online store.
- Anchor to status•string
Filter by a comma-separated list of statuses. You can use statuses to manage inventory. Shopify only displays products with an
status in online stores, sales channels, and apps.
- Anchor to vendor•string
Filter by the origin or source of the product. Learn more about vendors and managing vendor information.
vendor:Snowdevil
Example:
Example:
Example:
Example:
Example:
Example:
Example:
Example:
Example:
Example:
Example:
- Anchor to reversereverse•BooleanDefault:false
Reverse the order of the underlying list.
- Anchor to savedSearchIdsaved•
Search Id The ID of a saved search. The search’s query string is used as the query argument.
- Anchor to sortKeysort•
Key ProductSort Default:IDKeys Sort the underlying list using a key. If your query is slow or returns an error, then try specifying a sort key that matches the field used in the search.
Anchor to Possible returnsPossible returns
- Anchor to edgesedges•[Product
Edge!]! non-null The connection between the node and its parent. Each edge contains a minimum of the edge's cursor and the node.
- Anchor to nodesnodes•[Product!]!non-null
A list of nodes that are contained in ProductEdge. You can fetch data about an individual node, or you can follow the edges to fetch data about a collection of related nodes. At each node, you specify the fields that you want to retrieve.
- Anchor to pageInfopage•
Info PageInfo! non-null An object that’s used to retrieve cursor information about the current page.
Examples
1const { admin } = await authenticate.admin(request);23const response = await admin.graphql(4 `#graphql5 query {6 products(first: 10, after: "eyJsYXN0X2lkIjoyMDk5NTY0MiwibGFzdF92YWx1ZSI6IjIwOTk1NjQyIn0=") {7 edges {8 node {9 id10 title11 handle12 }13 cursor14 }15 pageInfo {16 hasNextPage17 }18 }19 }`,20);2122const data = await response.json();23
query {
products(first: 10, after: "eyJsYXN0X2lkIjoyMDk5NTY0MiwibGFzdF92YWx1ZSI6IjIwOTk1NjQyIn0=") {
edges {
node {
id
title
handle
}
cursor
}
pageInfo {
hasNextPage
}
}
}
curl -X POST \
https://your-development-store.myshopify.com/admin/api/2024-04/graphql.json \
-H 'Content-Type: application/json' \
-H 'X-Shopify-Access-Token: {access_token}' \
-d '{
"query": "query { products(first: 10, after: \"eyJsYXN0X2lkIjoyMDk5NTY0MiwibGFzdF92YWx1ZSI6IjIwOTk1NjQyIn0=\") { edges { node { id title handle } cursor } pageInfo { hasNextPage } } }"
}'
const { admin } = await authenticate.admin(request);
const response = await admin.graphql(
`#graphql
query {
products(first: 10, after: "eyJsYXN0X2lkIjoyMDk5NTY0MiwibGFzdF92YWx1ZSI6IjIwOTk1NjQyIn0=") {
edges {
node {
id
title
handle
}
cursor
}
pageInfo {
hasNextPage
}
}
}`,
);
const data = await response.json();
const client = new shopify.clients.Graphql({session});
const data = await client.query({
data: `query {
products(first: 10, after: "eyJsYXN0X2lkIjoyMDk5NTY0MiwibGFzdF92YWx1ZSI6IjIwOTk1NjQyIn0=") {
edges {
node {
id
title
handle
}
cursor
}
pageInfo {
hasNextPage
}
}
}`,
});
session = ShopifyAPI::Auth::Session.new(
shop: "your-development-store.myshopify.com",
access_token: access_token
)
client = ShopifyAPI::Clients::Graphql::Admin.new(
session: session
)
query = <<~QUERY
query {
products(first: 10, after: "eyJsYXN0X2lkIjoyMDk5NTY0MiwibGFzdF92YWx1ZSI6IjIwOTk1NjQyIn0=") {
edges {
node {
id
title
handle
}
cursor
}
pageInfo {
hasNextPage
}
}
}
QUERY
response = client.query(query: query)
Response
JSON1{2 "products": {3 "edges": [4 {5 "node": {6 "id": "gid://shopify/Product/108828309",7 "title": "Draft",8 "handle": "draft"9 },10 "cursor": "eyJsYXN0X2lkIjoxMDg4MjgzMDksImxhc3RfdmFsdWUiOiIxMDg4MjgzMDkifQ=="11 },12 {13 "node": {14 "id": "gid://shopify/Product/121709582",15 "title": "Boots",16 "handle": "boots"17 },18 "cursor": "eyJsYXN0X2lkIjoxMjE3MDk1ODIsImxhc3RfdmFsdWUiOiIxMjE3MDk1ODIifQ=="19 },20 {21 "node": {22 "id": "gid://shopify/Product/440089423",23 "title": "IPod Nano - 8GB",24 "handle": "ipod-nano"25 },26 "cursor": "eyJsYXN0X2lkIjo0NDAwODk0MjMsImxhc3RfdmFsdWUiOiI0NDAwODk0MjMifQ=="27 },28 {29 "node": {30 "id": "gid://shopify/Product/558169081",31 "title": "Unpublished Boots",32 "handle": "unpublished_boots"33 },34 "cursor": "eyJsYXN0X2lkIjo1NTgxNjkwODEsImxhc3RfdmFsdWUiOiI1NTgxNjkwODEifQ=="35 },36 {37 "node": {38 "id": "gid://shopify/Product/910489600",39 "title": "Crafty Shoes",40 "handle": "crappy-shoes"41 },42 "cursor": "eyJsYXN0X2lkIjo5MTA0ODk2MDAsImxhc3RfdmFsdWUiOiI5MTA0ODk2MDAifQ=="43 },44 {45 "node": {46 "id": "gid://shopify/Product/912855135",47 "title": "SEO Boots",48 "handle": "seo_boots"49 },50 "cursor": "eyJsYXN0X2lkIjo5MTI4NTUxMzUsImxhc3RfdmFsdWUiOiI5MTI4NTUxMzUifQ=="51 }52 ],53 "pageInfo": {54 "hasNextPage": false55 }56 }57}