Skip to content

Access to custom fields

Due to the fact that ACF stores the values of custom fields in Shopify Metafields, you can leverage Shopify’s API for handling those Metafields to update any field value inside ACF.

The field values for the various Shopify objects (shop level included) are just normal Metafields with the namespace and key as defined by you in ACF via your field definitions.

Using Shopify’s API you can create, update and delete Metafields as you see fit, but:

ACF’s internal field definitions are stored as shop-level Metafields in your store with some special namespaces unique to ACF. For uninterrupted service by ACF, don’t update these Metafields via the Shopify API.

Metafield type: string or json_string*

No value restrictions.

Metafield type: json_string

Must contain a stringified JSON object of this structure:

{
markdown: "# Heading level 1",
html: "<h1>Heading level 1</h1>"
}

The markdown property should contain valid markdown text and the html property the rendered version of that markdown. ACF internally uses the npm package markdown-it to render the HTML.

Metafield type: string or json_string*

No value restrictions as such, but should contain valid HTML. An invalid structure risks getting “cleaned” by the Froala editor if a user edits the content after API updates.

Metafield type: string or json_string*

Create a Metafield with the value “true” to indicate a checked checkbox. An unchecked checkbox should not have an existing Metafield (so you’ll never see a Metafield with the value “false” for a checkbox field).

Metafield type: string or json_string*

Any field value provided should be one of the defined options. Multiple tags must be separated by a pipe symbol (|) e.g. “In Stock|2 Weeks Delivery Time”.

Metafield type: string or json_string*

Multiple tags must be separated by a pipe symbol (|) e.g. “Blue|Used|1 Year Warranty”.

Metafield type: string or json_string*

Should contain a valid number with or without decimal points (.). The Metafield is a string to allow for non-integer values.

Metafield type: string or json_string*

Should contain a valid date in the format defined in the ACF field definition.

Metafield type: string or json_string*

Should contain a valid RGB color code in hex (#RRGGBB).

Metafield type: json_string

Should contain a valid stringified JSON object.

Metafield type: string or json_string*

The content of a media upload field is determined by ACF. To upload an image to ACF’s image storage from outside the editor (including from another store), you’ll need to use the Media upload API function.

Metafield type: string or json_string*

Reference fields should contain one or more handles of the referenced object(s). Variant reference fields should contain the product’s handle and the referenced variant’s id in the form handle:id. Multiple handles must be separated by a pipe symbol (“|”) e.g. “my-awesome-product|my-other-awesome-product”.

All fields in ACF can be repeated. Whenever a field is defined as repeatable, any Metafields created for that field definition automatically become a json_string type with the value being an array of the field value(s).

The content restrictions for the field type still apply, but now for every element in the array. If an element in the array doesn’t exist, you should use an empty string (“”) as a placeholder.

If multiple repeatable fields “belong together” (like a FAQ setup with questions and associated answers), the array structure for each field should match each other, so the individual values share the same index in their respective arrays.

Multi-language fields are structured in JSON objects with the individual language locales as keys.