Use a metafield automation when your related Shopify products already share a style code or refer to one another through a product list. This also works when an ERP or another integration maintains those metafield values.
Automations are available on Advanced and Premium.
Choose how products belong together
Use one of these product metafield types in Shopify:
Single-line text: give related products the same value. For example, the black, blue, and green versions of a shirt could all have
LINEN-01in a style-code field. Products with another value form another group. Products without a value are not grouped by that field.List of products: use product references to connect related products. Populate the related-product lists on the products you want to group. Connected lists combine: if one product links to a second, and the second links to a third, they can belong to the same group.
The Grouping metafield decides which products belong together. A Swatch name metafield serves a different purpose: it supplies a label such as Black or Blue for each product.
Create the automation
Open Product groups > Automations in Color Swatches.
Select Create automation.
Set Automatically group products using to Metafields.
Select your Grouping metafield. If a new definition is missing, use Reload metafields beside the field and check again.
Under Group attributes, choose Group displayed on. Select Product and collection widget to use the groups in both places.
Enter an Option name, such as
Color.Choose a Swatch type: Product image, Auto-detect, Image with text, or Pill / Button.
Set the swatch names and optional ordering using the instructions below.
Select Create, then Activate.
If a definition still does not appear, check that it is a product metafield with one of the supported grouping types above.
Set the swatch names
Choose Swatch name source:
Product metafield: select a Swatch name metafield containing the color or style name for each product. It can contain single-line text or a list of text values.
Product title: use each product's Shopify title as its swatch name. A separate name metafield is not required.
With Auto-detect, these names are used to find matching color or image swatches in your Library. If there is no match, a product image is used. Image with text and Pill / Button also need a name from the configured source; a missing name falls back to a product image.
To use only part of a name, fill in Transformation (optional). For a title such as Linen shirt | Ocean, this expression produces Ocean:
{{ source | split: "|" | last | strip }}
Use this example when your titles follow that format. Leave the transformation blank to use the full source value. The same control is available for names supplied by a metafield and in collection automations.
Set the swatch order
Select an integer Swatch position metafield and enter positions such as 1, 2, and 3 on the products in Shopify. Products without that value use the default order.
Group position controls the order of separate groups shown on a product page. Use Swatch position metafield to order the products within each group.
Maintain the groups
Update the source metafield values or product lists in Shopify when membership should change. For product lists, remove the connections keeping a product in the group; removing one reference may not separate it if another still connects it.
Active automations run every 60 minutes. To apply changes sooner, open the automation and select Run now when no run is in progress. Save any changes to the automation itself before running it.
If Skip groups with a single product is enabled, groups with only one eligible product are skipped or removed.
Enable the swatches widgets in your theme to display the groups. If the result is incomplete, follow Troubleshoot an automation that stopped or skipped products.