Smart Collection or Custom Collection

Shopify Partner
44 4 13

Given a collection_id what would be the simplest way to tell if it is a custom collection or a smart collection?


I mean in if a customer selects a collection from resource picker, is there any simpler or effective solution than looking up if it is a custom collection and if it throws a not found error, look it up as a smart collection?


Anyone got a better way?

Need some help or work done? Hire me!
Reply 1 (1)
Shopify Staff
Shopify Staff
1561 81 334

While there doesn't appear to be any straight forward ways currently, you could use GraphQL to get a collection by ID, and check for the presence of a ruleSet field:


  collection(id: "gid://shopify/Collection/70392479766") {
    ruleSet {
      rules {


It will be null for any custom collections, and there will be values for any smart collections.



Alex | Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog