products
List of the shop's products.
products(
filter: ProductFilterInput
where: ProductWhereInput
sortBy: ProductOrder
search: String
channel: String
before: String
after: String
first: Int
last: Int
): ProductCountableConnection
Arguments
products.filter
● ProductFilterInput
input products
Filtering options for products.
products.where
● ProductWhereInput
input products
Where filtering options.
Added in Saleor 3.14This API is currently in Feature Preview and can be subject to changes at later point.
products.sortBy
● ProductOrder
input products
Sort products.
products.search
● String
scalar miscellaneous
Search products.
Added in Saleor 3.14
products.channel
● String
scalar miscellaneous
Slug of a channel for which the data should be returned.
products.before
● String
scalar miscellaneous
Return the elements in the list that come before the specified cursor.
products.after
● String
scalar miscellaneous
Return the elements in the list that come after the specified cursor.
products.first
● Int
scalar miscellaneous
Retrieve the first n elements from the list. Note that the system only allows fetching a maximum of 100 objects in a single query.
products.last
● Int
scalar miscellaneous
Retrieve the last n elements from the list. Note that the system only allows fetching a maximum of 100 objects in a single query.
Type
ProductCountableConnection
object products
Examples
Get products
Get the first ten products
The following query retrieves the first ten products for a channel and returns the associated ID.
Query arguments | |
---|---|
first: Int | Return the first n elements from the list. |
channel: String | Slug of a channel for which the data should be returned. |
Returns up to the first n elements from the list.
Query
{
products(first: 10, channel: "default-channel") {
edges {
node {
id
name
}
}
}
}
Response
{
"data": {
"products": {
"edges": [
{
"node": {
"id": "UHJvZHVjdDoxOTY=",
"name": "1970-1982"
}
},
{
"node": {
"id": "UHJvZHVjdDoxOTg=",
"name": "ABBA Again"
}
},
{
"node": {
"id": "UHJvZHVjdDoyMDA=",
"name": "ABBA - MP3"
}
},
{
"node": {
"id": "UHJvZHVjdDoxNzc=",
"name": "Aniversario Los 10 Años De ABBA"
}
},
{
"node": {
"id": "UHJvZHVjdDoxNjY=",
"name": "A Wie ABBA (Die Grössten Erfolge Von »Waterloo« Bis »Super Trouper«)"
}
}
]
}
},
"extensions": {
"cost": {
"requestedQueryCost": 5,
"maximumAvailable": 50000
}
}
}
Expand ▼