Access field definitions
For each of the scopes, ACF offers custom fields for, selected properties from the custom fields definitions are surfaced to a special metafield for you to use in your theme with Liquid. You can query the defined labels, the instructions etc. or show your custom fields on the storefront in the same order as defined in ACF.

Metafields

If any custom fields have been created for the scope, the following metafields are available: shop.metafields.acf_settings.product shop.metafields.acf_settings.variant shop.metafields.acf_settings.collection shop.metafields.acf_settings.page shop.metafields.acf_settings.blog shop.metafields.acf_settings.article shop.metafields.acf_settings.order shop.metafields.acf_settings.customer shop.metafields.acf_settings.shop shop.metafields.acf_settings.product_type shop.metafields.acf_settings.vendor shop.metafields.acf_settings.location shop.metafields.acf_settings.global
Each of these metafields contains a fields array containing the defined fields - excluding any sections.

Properties

Each element in the fields array has the following properties:
name
The name defined for the custom field. This is used as the key property in the metafields created for each value.
namespace
The namespace defined for the custom field. This is used as the namespace property in the metafields created for each value.
type
The type of field (text, checkbox etc.)
label
The label defined for the custom field, which is also used in the ACF editor.
instructions
These are the same instructions as shown in the ACF editor (with any Markdown translated into HTML). When using these on the storefront, take care that they are not authored for internal use.
repeatable
A boolean true if the field is defined as repeatable.
value
Depends on the type of field. E.g. for a Media field, the value will be a pipe-separated list of MIME types, or for a Selection field a pipe-separated list of options.
allow_multiple
A boolean true if the field allows for multiple selections.
section
If this field belongs to a section, you will find an id property for that section as well as a label property with the section's label. The id property is a unique internal id, that allows you to logically discern which fields belong to different sections.

Examples

Showing the label for the field "size" before the field value:
1
{% assign field = shop.metafields.acf_settings.product.fields | where: "name", "size" | first %}
2
<p>{{ field.label }}: {{ product.metafields.accentuate.size }}</p>
Copied!
Listing custom fields in the same order as defined in ACF:
1
{% for field in shop.metafields.acf_settings.product.fields %}
2
{% assign field_value = product.metafields[field.namespace][field.name] %}
3
<p>{{ field.label }}: {{ field_value }}</p>
4
{% endfor %}
Copied!
Listing custom fields with section headers:
1
{% for field in shop.metafields.acf_settings.product.fields %}
2
3
{% assign field_section = field.section %}
4
{% assign field_value = product.metafields[field.namespace][field.name] %}
5
6
{% if field_section.id != current_section.id %}
7
<h3>{{ field_section.label }}</h3>
8
{% endif %}
9
<p>{{ field.label }}: {{ field_value }}</p>
10
11
{% assign current_section = field_section %}
12
13
{% endfor %}
Copied!
Getting the entry for a specific field:
1
{‰ assign my_field_def = shop.metafields.acf_settings.product.fields | where: "namespace", "accentuate" | where: "name", "my_custom_field" | first %}
2
3
{% if my_field_def.repeatable %}
4
<p>This field is defined as repeatable</p>
5
{% endif %}
Copied!
Last modified 11d ago