Liquid access to field definitions

For each of the scopes, ACF offers custom fields for, selected properties for 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.


If any custom fields have been created for the scope, the following metafields are available:


Each of these metafields contains a fields array containing the defined fields - excluding any sections.

Since this is a new feature, you may need to save your custom field definitions for the scope before the metafield is available (click Save even if no changes are made)


Each element in the  fields array has the following properties:


The name defined for the custom field. This is used as the key property in the metafields created for each value


The namespace defined for the custom field. This is used as the namespace property in the metafields created for each value


The type of field (text, checkbox etc.)


The label defined for the custom field, which is also used in the ACF editor


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


A boolean true if the field is defined as repeatable


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.


A boolean  true if the field allows for multiple selections


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


Showing the label for the field "size" before the field value:

{% assign field = shop.metafields.acf_settings.product.fields | where: "name", "size" | first %}
<p>{{ field.label }}: {{ product.metafields.accentuate.size }}</p>

Listing custom fields in the same order as defined in ACF:

{% for field in shop.metafields.acf_settings.product.fields %}
  {% assign field_value = product.metafields[field.namespace][] %}
  <p>{{ field.label }}: {{ field_value }}</p>
{% endfor %}

Listing custom fields with section headers:

{% for field in shop.metafields.acf_settings.product.fields %}

  {% assign field_section = field.section %}
  {% assign field_value = product.metafields[field.namespace][] %}

  {% if != %}
  <h3>{{ field_section.label }}</h3>
  {% endif %}
  <p>{{ field.label }}: {{ field_value }}</p>

  {% assign current_section = field_section %}

{% endfor %}
Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us