Automatic tagging

ACF supports automatic tagging (and untagging) for products, articles, customers and orders when entering or importing values for these object types (including product variants). Automatic tagging of e.g. products will allow you to filter collections by custom field values on your storefront using either Automated Collections or Shopify's built-in tag filtering You can enable this in the field definition for the following field types

  • Text fields

  • Checkboxes

  • Tags

  • Selections

  • Number fields

  • Number ranges

  • Colors

  • Reference fields

Tags are applied in the form of the field's label (e.g. "Brand") followed by either a "pipe" symbol ("|"), an underscore ("_") or a colon (":") and the value of the field.

To use underscores ("_") or colons (":") for the split character in the automatically applied tags, select this under "Settings" from the ACF's main dashboard.

A tag in Shopify (here: label and value combined) cannot be longer than 40 characters

For fields that can hold multiple values, like repeatable fields or fields that allow for multiple selections, multiple tags may be created and applied to the product as a result of the automatic tagging. Tags for checked checkboxes, where the value resolves to "true", only hold the field's label e.g. "New look", "Backordered" etc. Tags for reference fields will contain the referenced object's handle Automatic tagging occurs whenever you change a value using the editor. This also means that if you enable automatic tagging on a custom field, the tags won't be updated unless you save the custom field with a changed value. To fix tags for existing values, export the objects and import the exported file unchanged. This will synchronize the tags with the existing values. ACF also offers an API endpoint to trigger the automatic tagging process

Example

You have a selection list of brands as a product custom field with available options like "Hugo Boss", "Tommy Hilfiger", "SuperDry" etc. with automatic tagging enabled. You then select one of these brands in the dropdown for a given product (or variant) and the constructed value "Brand|Hugo Boss" is applied as a tag to the product (or variant's product) when the custom fields are saved. If you later select another brand, the old tag is removed and a new one applied. Tags can then be used for collection filtering in Shopify when you 'handleize' the value, so this url will filter a collection for Hugo Boss branded products: https://my-store.myshopify.com/collections/all-brands/brand-hugo-boss

Last updated