openbridge.products.list()
openbridge.products.list().limit(20).select(['title', 'handle'])
openbridge.products.list().collection('sale').limit(10)
Chainable Methods
| Method | Description |
|---|---|
.limit(count) | Limit number of results (default: 250) |
.after(cursor) | Fetch results after cursor (pagination) |
.before(cursor) | Fetch results before cursor (pagination) |
.search(query) | Filter by search query |
.collection(handle) | Filter by collection handle or GID |
.select(fields) | Limit returned fields |
Returns
ProductsResult
{
items: ShopifyProduct[]
pageInfo: ShopifyPageInfo
}
Examples
Basic
const { items, pageInfo } = await openbridge.products.list()
With limit
const { items } = await openbridge.products
.list()
.limit(20)
With field selection
const { items } = await openbridge.products
.list()
.limit(20)
.select(['title', 'handle', 'priceRange'])
From collection
const { items } = await openbridge.products
.list()
.collection('new-arrivals')
.limit(8)
With search
const { items } = await openbridge.products
.list()
.search('blue shirt')
.limit(10)
Full chain
const { items, pageInfo } = await openbridge.products
.list()
.collection('sale')
.limit(12)
.select([
'title',
'handle',
'priceRange',
'featuredImage',
'availableForSale'
])
Pagination
const page1 = await openbridge.products.list().limit(10)
if (page1.pageInfo.hasNextPage && page1.pageInfo.endCursor) {
const page2 = await openbridge.products
.list()
.limit(10)
.after(page1.pageInfo.endCursor)
}