Accentuate Custom Fields
  • Welcome!
  • Introduction
    • Getting started with ACF
    • Field scopes
    • How to show fields in your storefront
  • Dashboard
    • Reference Manager
      • Creating a new reference within Reference Manager
    • Filter & Group
      • Filter editor
      • Filter usage
    • Activity log
    • App settings
  • Field Definitions
    • Fields & Sections
    • Deciding on a field type
    • ACF Field types
      • Text
      • Markdown text
      • HTML
      • Checkbox
      • Selection
      • Tags
      • Number
      • Date
      • Color
      • Media v1 (legacy)
      • Media v2
      • Custom Object (JSON)
      • Multi-language Text
      • Reference fields
      • References to Global fields
    • Shopify Field types
      • Shopify » Single line text
      • Shopify » Multi-line text
      • Shopify » Boolean
      • Shopify » Color
      • Shopify » Custom objects (JSON)
      • Shopify » URL
      • Shopify » Date
      • Shopify » Date and Time
      • Shopify » Integer
      • Shopify » Decimal
      • Shopify » Weight
      • Shopify » Volume
      • Shopify » Dimensions
      • Shopify » Reference fields
    • Automatic tagging
    • Large sets
    • Field contexts
    • Field context filters
    • Copy and paste fields
    • Change field name and type
    • Import existing fields
    • Linking multiple stores
  • The Editor
    • Using the editor
    • Promote fields to sidebar
    • Layouts
    • Hide from search
    • Repeatable fields
    • Version control
    • Update value on order creation
  • Bulk Import & Export
    • Export custom field values
    • Import custom field values
    • Metaobject export / import
  • METAOBJECTS
    • What are Metaobjects?
    • Metaobject Definitions
    • Metaobject instances / values
    • Displaying Metaobjects on your storefront
    • Metaobject export / import
  • THEME EXTENSIONS
    • SEO keywords
    • Sticky promo bar
    • Products promotion
  • Liquid Guides
    • Learning Liquid
    • Resize & crop images
    • Check for empty values
    • Access field definitions
    • Order notifications
    • Allow customers to change their field values
  • OTHER
    • Webhooks
    • API
      • Access to custom fields
      • Endpoints
  • Help
    • FAQ
      • Why are one of my products no longer showing in my reference field?
      • I have multiple products/variants with the same name
      • How do I make changes to my field values in bulk?
      • I added a new field definition but it is not showing in my storefront
      • How do I copy my field setup to another store?
      • My fields are still showing after I have deleted their field definition
      • Why are none of my fields showing in the editor?
      • My newly created object in Shopify is not available in ACF
      • Reference lists are empty?
      • Why am I seeing a "value cannot exceed 100,000 characters" error when saving?
      • Why can't I name my field "first", "last" or "size"?
    • Need help?
  • Product
    • Changelog
    • Feedback & Suggestions
Powered by GitBook
On this page
  • Metafields
  • Properties
  • Examples
  1. Liquid Guides

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. For example, 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:

{% 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][field.name] %}
  <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][field.name] %}

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

  {% assign current_section = field_section %}

{% endfor %}

Getting the entry for a specific field:

{‰ assign my_field_def = shop.metafields.acf_settings.product.fields | where: "namespace", "accentuate" | where: "name", "my_custom_field" | first %}

{% if my_field_def.repeatable %}
  <p>This field is defined as repeatable</p>
{% endif %}
PreviousCheck for empty valuesNextOrder notifications

Last updated 11 months ago