Skip to main content
shoppy.collections.get(idOrHandle)
Fetches a single collection by handle or Shopify GID.

Parameters

ParamTypeRequiredDescription
idOrHandlestringYesCollection handle or Shopify GID

Returns

ShopifyCollection | null

Examples

Get by handle

const collection = await shoppy.collections.get('summer-sale')

if (collection) {
    console.log(collection.title)
}

Get by Shopify GID

const collection = await shoppy.collections.get(
    'gid://shopify/Collection/123456789'
)

With field selection

const collection = await shoppy.collections
    .select(['title', 'handle', 'image', 'seo'])
    .get('new-arrivals')

Handle not found

const collection = await shoppy.collections.get('non-existent')

if (!collection) {
    console.log('Collection not found')
}