Skip to content

Collections

Joshua Harms edited this page Jan 21, 2025 · 2 revisions

Collections

Warning

All public Shopify apps (i.e. those published on the Shopify App Store) are required to switch over to using the GraphQL product API by February 1st. All custom apps are required to switch by April 1st. Go here for a migration guide on using ShopifySharp's GraphService to query and mutate Shopify's GraphQL API.

API version 2020-01 introduced the new "Collections" endpoint, which can be used to get the base details and list of products associated with either a Custom Collection or Smart Collection.

This endpoint cannot be used to manipulate the products, collects, custom collections or smart collections. You must use the entity's respective ShopifySharp service to do that (i.e. CollectService, ProductService, CustomCollectionService and SmartCollectionService).

Getting a Collection

var service = new CollectionService(myShopifyUrl, shopAccessToken);
var collection = await service.GetAsync(collectionId);

Listing products belonging to a Collection

var service = new CollectionService(myShopifyUrl, shopAccessToken);
var products = await service.ListAsync(collectionId);
Clone this wiki locally