-
-
Notifications
You must be signed in to change notification settings - Fork 312
Custom Collections
Joshua Harms edited this page Jan 21, 2025
·
2 revisions
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.
A custom collection is a grouping of products that a shop owner can create to make their shops easier to browse. A shop owner creates a custom collection and then selects the products that will go into it.
var service = new CustomCollectionService(myShopifyUrl, shopAccessToken);
var collection = await service.CreateAsync(new CustomCollection()
{
Title = "My Custom Collection",
Published = true,
PublishedAt = DateTime.UtcNow,
Image = new CustomCollectionImage()
{
Src = "https://placekitten.com/250/250"
}
});
var service = new CustomCollectionService(myShopifyUrl, shopAccessToken);
var collection = await service.GetAsync(collectionId);
var service = new CustomCollectionService(myShopifyUrl, shopAccessToken);
var count = await service.CountAsync();
var service = new CustomCollectionService(myShopifyUrl, shopAccessToken);
var collections = await service.ListAsync();
var service = new CustomCollectionService(myShopifyUrl, shopAccessToken);
var collection = await service.UpdateAsync(collectionId, new Collection()
{
Title = "My new collection title"
});
var service = new CustomCollectionService(myShopifyUrl, shopAccessToken);
await service.DeleteAsync(collectionId);