collection By Handle
Requires access scope.
Retrieves a collection by its unique handle identifier. Handles provide a URL-friendly way to reference collections and are commonly used in storefront URLs and navigation.
For example, a collection with the title "Summer Sale" might have the handle summer-sale, allowing you to fetch it directly without knowing the internal ID.
Use to:
- Fetch collections for storefront display and navigation
- Build collection-based URLs and routing systems
- Validate collection existence before displaying content
Handles are automatically generated from collection titles but can be customized by merchants for SEO and branding purposes.
Learn more about collections.
Arguments
- Anchor to handlehandle•String!required
The handle of the collection.
Anchor to Possible returnsPossible returns
- Anchor to CollectionCollection•Collection
The
Collectionobject represents a group of products that merchants can organize to make their stores easier to browse and help customers find related products. Collections serve as the primary way to categorize and display products across online stores, sales channels, and marketing campaigns.There are two types of collections:
- Custom (manual) collections: You specify the products to include in a collection.
- Smart (automated) collections: You define rules, and products matching those rules are automatically included in the collection.
The
Collectionobject provides information to:- Organize products by category, season, or promotion.
- Automate product grouping using rules (for example, by tag, type, or price).
- Configure product sorting and display order (for example, alphabetical, best-selling, price, or manual).
- Manage collection visibility and publication across sales channels.
- Add rich descriptions, images, and metadata to enhance discovery.
NoteCollections can be displayed in a store with Shopify's theme system through Liquid templates and can be customized with template suffixes for unique layouts. They also support advanced features like translated content, resource feedback, and contextual publication for location-based catalogs.
Learn about using metafields with smart collections.
- Anchor to activeOperationsactive•Collection
Operations Operations! non-null Collection duplicate operations involving this collection, either as a source (copying products from this collection to another) or a target (copying products to this collection from another).
- Anchor to availablePublicationsCountavailable•Count
Publications Count The number of publications that a resource is published to, without feedback errors.
- Anchor to descriptiondescription•String!non-null
A single-line, text-only description of the collection, stripped of any HTML tags and formatting that were included in the description.
- Anchor to truncateAttruncate•Int
At Truncates a string after the given length.
Arguments
- Anchor to descriptionHtmldescription•HTML!
Html non-null The description of the collection, including any HTML tags and formatting. This content is typically displayed to customers, such as on an online store, depending on the theme.
- Anchor to eventsevents•Event
Connection! non-null The paginated list of events associated with the host subject.
- Anchor to firstfirst•Int
The first
nelements from the paginated list.- Anchor to afterafter•String
The elements that come after the specified cursor.
- Anchor to lastlast•Int
The last
nelements from the paginated list.- Anchor to beforebefore•String
The elements that come before the specified cursor.
- Anchor to reversereverse•BooleanDefault:false
Reverse the order of the underlying list.
- Anchor to sortKeysort•Event
Key Sort Keys Default:ID Sort the underlying list using a key. If your query is slow or returns an error, then try specifying a sort key that matches the field used in the search.
- Anchor to queryquery•String
A filter made up of terms, connectives, modifiers, and comparators. You can apply one or more filters to a query. Learn more about Shopify API search syntax.
- Anchor to comments•boolean
Whether or not to include comment-events in your search, passing
falsewill exclude comment-events, any other value will include comment-events.falsetrue- Anchor to created_at•time
Filter by the date and time when the event happened.
created_at:>2020-10-21created_at:<now- Anchor to subject_type•string
The resource type affected by this event. See EventSubjectType for possible values.
PRODUCT_VARIANTPRODUCTCOLLECTION
Example:
Example:
Example:
Arguments
- Anchor to feedbackfeedback•Resource
Feedback Information about the collection that's provided through resource feedback.
- Anchor to handlehandle•String!non-null
A unique string that identifies the collection. If a handle isn't specified when a collection is created, it's automatically generated from the collection's original title, and typically includes words from the title separated by hyphens. For example, a collection that was created with the title
Summer Catalog 2022might have the handlesummer-catalog-2022.If the title is changed, the handle doesn't automatically change.
The handle can be used in themes by the Liquid templating language to refer to the collection, but using the ID is preferred because it never changes.
- Anchor to hasProducthas•Boolean!
Product non-null Whether the collection includes the specified product.
- •ID!required
The ID of the product to check.
Arguments
- •ID!
- •ID!non-null
A globally-unique ID.
- Anchor to imageimage•Image
The image associated with the collection.
- Anchor to maxWidthmax•Int
Width Deprecated - Anchor to maxHeightmax•Int
Height Deprecated - Anchor to cropcrop•Crop
Region Deprecated - Anchor to scalescale•IntDeprecatedDefault:1
Arguments
- Anchor to legacyResourceIdlegacy•Unsigned
Resource Id Int64! non-null The ID of the corresponding resource in the REST Admin API.
- Anchor to metafieldmetafield•Metafield
A custom field, including its
namespaceandkey, that's associated with a Shopify resource for the purposes of adding and storing additional information.- Anchor to namespacenamespace•String
The container the metafield belongs to. If omitted, the app-reserved namespace will be used.
- •String!required
The key for the metafield.
Arguments
- Anchor to metafieldsmetafields•Metafield
Connection! non-null A list of custom fields that a merchant associates with a Shopify resource.
- Anchor to namespacenamespace•String
The metafield namespace to filter by. If omitted, the app-reserved namespace will be used.
- Anchor to keyskeys•[String!]
List of keys of metafields in the format
namespace.key, will be returned in the same format.- Anchor to firstfirst•Int
The first
nelements from the paginated list.- Anchor to afterafter•String
The elements that come after the specified cursor.
- Anchor to lastlast•Int
The last
nelements from the paginated list.- Anchor to beforebefore•String
The elements that come before the specified cursor.
- Anchor to reversereverse•BooleanDefault:false
Reverse the order of the underlying list.
Arguments
- Anchor to metafieldsByIdentifiersmetafields•[Metafield]!
By Identifiers non-null The metafields associated with the resource matching the supplied list of namespaces and keys.
- Anchor to identifiersidentifiers•[Has
Metafields Identifier!]! required The list of metafields to retrieve by namespace and key.
Arguments
- Anchor to productsproducts•Product
Connection! non-null The products that are included in the collection.
- Anchor to firstfirst•Int
The first
nelements from the paginated list.- Anchor to afterafter•String
The elements that come after the specified cursor.
- Anchor to lastlast•Int
The last
nelements from the paginated list.- Anchor to beforebefore•String
The elements that come before the specified cursor.
- Anchor to reversereverse•BooleanDefault:false
Reverse the order of the underlying list.
- Anchor to sortKeysort•Product
Key Collection Sort Keys Default:COLLECTION_DEFAULT Sort the underlying list using a key. If your query is slow or returns an error, then try specifying a sort key that matches the field used in the search.
Arguments
- Anchor to publishedOnCurrentPublicationpublished•Boolean!
On Current Publication non-null Whether the resource is published to the app's publication. For example, the resource might be published to the app's online store channel.
- Anchor to publishedOnPublicationpublished•Boolean!
On Publication non-null Whether the resource is published to a specified publication.
- Anchor to publicationIdpublication•ID!
Id required The ID of the publication to check. For example,
.
Arguments
- Anchor to resourcePublicationsresource•Resource
Publications Publication Connection! non-null The list of resources that are published to a publication.
- Anchor to onlyPublishedonly•Boolean
Published Default:true Whether to return only the resources that are currently published. If false, then also returns the resources that are scheduled to be published.
- Anchor to firstfirst•Int
The first
nelements from the paginated list.- Anchor to afterafter•String
The elements that come after the specified cursor.
- Anchor to lastlast•Int
The last
nelements from the paginated list.- Anchor to beforebefore•String
The elements that come before the specified cursor.
- Anchor to reversereverse•BooleanDefault:false
Reverse the order of the underlying list.
Arguments
- Anchor to resourcePublicationsCountresource•Count
Publications Count The number of publications that a resource is published to, without feedback errors.
- Anchor to onlyPublishedonly•Boolean
Published Default:true Include only the resource's publications that are published. If false, then return all the resource's publications including future publications.
Arguments
- Anchor to resourcePublicationsV2resource•Resource
Publications V2 Publication V2Connection! non-null The list of resources that are either published or staged to be published to a publication.
- Anchor to onlyPublishedonly•Boolean
Published Default:true Whether to return only the resources that are currently published. If false, then also returns the resources that are scheduled or staged to be published.
- Anchor to catalogTypecatalog•Catalog
Type Type Filter publications by catalog type.
- Anchor to firstfirst•Int
The first
nelements from the paginated list.- Anchor to afterafter•String
The elements that come after the specified cursor.
- Anchor to lastlast•Int
The last
nelements from the paginated list.- Anchor to beforebefore•String
The elements that come before the specified cursor.
- Anchor to reversereverse•BooleanDefault:false
Reverse the order of the underlying list.
Arguments
- Anchor to ruleSetrule•Collection
Set Rule Set For a smart (automated) collection, specifies the rules that determine whether a product is included.
- •SEO!non-null
If the default SEO fields for page title and description have been modified, contains the modified information.
- Anchor to sortOrdersort•Collection
Order Sort Order! non-null The order in which the products in the collection are displayed by default in the Shopify admin and in sales channels, such as an online store.
- Anchor to templateSuffixtemplate•String
Suffix The suffix of the Liquid template being used to show the collection in an online store. For example, if the value is
custom, then the collection is using thecollection.custom.liquidtemplate. If the value isnull, then the collection is using the defaultcollection.liquidtemplate.- Anchor to titletitle•String!non-null
The name of the collection. It's displayed in the Shopify admin and is typically displayed in sales channels, such as an online store.
- Anchor to translationstranslations•[Translation!]!non-null
The published translations associated with the resource.
- Anchor to localelocale•String!required
Filters translations locale.
- Anchor to marketIdmarket•ID
Id Filters translations by market ID. Use this argument to retrieve content specific to a market.
Arguments
- Anchor to unpublishedPublicationsunpublished•Publication
Publications Connection! non-null The list of publications that the resource isn't published to.
- Anchor to firstfirst•Int
The first
nelements from the paginated list.- Anchor to afterafter•String
The elements that come after the specified cursor.
- Anchor to lastlast•Int
The last
nelements from the paginated list.- Anchor to beforebefore•String
The elements that come before the specified cursor.
- Anchor to reversereverse•BooleanDefault:false
Reverse the order of the underlying list.
Arguments
- Anchor to updatedAtupdated•Date
At Time! non-null The date and time (ISO 8601 format) when the collection was last modified.
- Anchor to metafieldDefinitionsmetafield•Metafield
Definitions Definition Connection! non-nullDeprecated - Anchor to namespacenamespace•String
Filter metafield definitions by namespace.
- Anchor to pinnedStatuspinned•Metafield
Status Definition Pinned Status Default:ANY Filter by the definition's pinned status.
- Anchor to firstfirst•Int
The first
nelements from the paginated list.- Anchor to afterafter•String
The elements that come after the specified cursor.
- Anchor to lastlast•Int
The last
nelements from the paginated list.- Anchor to beforebefore•String
The elements that come before the specified cursor.
- Anchor to reversereverse•BooleanDefault:false
Reverse the order of the underlying list.
- Anchor to sortKeysort•Metafield
Key Definition Sort Keys Default:ID Sort the underlying list using a key. If your query is slow or returns an error, then try specifying a sort key that matches the field used in the search.
- Anchor to queryquery•String
A filter made up of terms, connectives, modifiers, and comparators. You can apply one or more filters to a query. Learn more about Shopify API search syntax.
- Anchor to default•string
Filter by a case-insensitive search of multiple fields in a document.
query=Bob Normanquery=title:green hoodie- Anchor to created_at•time
Filter by the date and time when the metafield definition was created.
created_at:>2020-10-21T23:39:20Zcreated_at:<nowcreated_at:<=2024- Anchor to namespace•string
Filter by the metafield definition
namespacefield.namespace:some-namespace- Anchor to type•string
Filter by the metafield definition
typefield.type:single_line_text_field- Anchor to updated_at•time
Filter by the date and time when the metafield definition was last updated.
updated_at:>2020-10-21T23:39:20Zupdated_at:<nowupdated_at:<=2024
Example:
Example:
Example:
Example:
Example:
Arguments
- Anchor to publicationCountpublication•Int!
Count non-nullDeprecated - Anchor to onlyPublishedonly•Boolean
Published Default:true Include only the resource's publications that are published. If false, then return all the resource's publications including future publications.
Arguments
- Anchor to publicationspublications•Collection
Publication Connection! non-nullDeprecated - Anchor to onlyPublishedonly•Boolean
Published Default:true Whether or not to return only the collection publications that are published.
- Anchor to firstfirst•Int
The first
nelements from the paginated list.- Anchor to afterafter•String
The elements that come after the specified cursor.
- Anchor to lastlast•Int
The last
nelements from the paginated list.- Anchor to beforebefore•String
The elements that come before the specified cursor.
- Anchor to reversereverse•BooleanDefault:false
Reverse the order of the underlying list.
Arguments
- Anchor to publishedOnChannelpublished•Boolean!
On Channel non-nullDeprecated - Anchor to channelIdchannel•ID!
Id required The ID of the channel to check.
Arguments
- Anchor to publishedOnCurrentChannelpublished•Boolean!
On Current Channel non-nullDeprecated - Anchor to storefrontIdstorefront•Storefront
Id ID! non-nullDeprecated - Anchor to unpublishedChannelsunpublished•Channel
Channels Connection! non-nullDeprecated - Anchor to firstfirst•Int
The first
nelements from the paginated list.- Anchor to afterafter•String
The elements that come after the specified cursor.
- Anchor to lastlast•Int
The last
nelements from the paginated list.- Anchor to beforebefore•String
The elements that come before the specified cursor.
- Anchor to reversereverse•BooleanDefault:false
Reverse the order of the underlying list.
Arguments