Use metafield capabilities
Capabilities provide a way to mix in behaviors and logic with your metafields. When you create a metafield definition, you can enable capabilities
that provide additional behavior. You can enable the following capabilities:
- Smart collection: Create an automated collection based on metafield values for a given definition.
- Admin filterable: Filter products based on metafield values for a definition.
Smart collection
Anchor link to section titled "Smart collection"An automated collection, also known as a smart collection, is a grouping of products that's defined by a set of rules. Shopify automatically changes the contents of an automated collection based on the configured rules. You can create rules with metafield definitions to automatically update the contents of an automated collection based on product or variant metafields.
- To create a smart collection, you can use the
collectionCreate
mutation. - To update an existing collection, you can use the
collectionUpdate
mutation. - To enable this capability, you can use the
metafieldDefinitionUpdate
mutation.
The following example shows how to create a metafield definition with the smartCollectionCondition
set to true
to enable the smart collection capability:
Admin filterable
Anchor link to section titled "Admin filterable"The admin filterable capability allows you to use a metafield definition and its values to filter products in the product list page in the Shopify admin. This capability makes it easier for merchants to find and manage products based on specific metafield values.
To enable this capability, you can use the metafieldDefinitionUpdate
mutation.
The following example shows how to create a metafield definition with adminFilterable
set to true
to enable the admin filterable capability: