Skip to main content
Print

Shopify Metaobject Entries

The transmitter creates, updates and deletes entries of existing metaobjects, e.g. the colours behind a linked colour option. An entry is identified by the type of its metaobject definition and its handle. The station template includes the datamap Shopify Metaobject Entries for this. The setup is on Shopify Transmitter.

Available from: 1.19.5 · 1.20.0; the current datamap (status and template suffix of entries) needs 1.21.20

In Shopify

Create the metaobject definition in Shopify (Settings > Custom data > Metaobject definitions); the transmitter only maintains entries. From the definition you need its type and the keys of its fields, e.g. type color with the fields label and hex.

Metaobject definition with its type and fields

Value ranges become entries

The template creates one entry per value of a value-range attribute:

EntryFrom
Typethe attribute’s external key; it must be the definition’s type
Handlethe value’s external key
Field labelthe value, in every language (the other languages become translations)
Field hex (colour)the value’s external key through a transformation list
Value range whose values become metaobject entries

In the metaobject job, select the value-range attributes whose values should become entries, or a folder that contains them:

The metaobject job with an attribute folder as its root node

Important:

  • Other attributes in the selection, e.g. in a selected folder, are skipped (from 1.21.19). Up to 1.21.18, select only the value-range attributes: every other attribute causes a PHP warning in the server log, although the entries are still created.
  • If the attribute’s external key cannot be the definition type (e.g. because it is taken), send the type as a fixed value in the row type. The datamap then serves that one definition.

Datamap rows

The node mapping metaobjectUpdateCreate has the rows type (1), metaobjectInput|[replace_recursive] with the entries (2), and additionalInformation:

Rows of the metaobject datamap

The entries row loops over the values of the value range (1). Each entry has the handle and one field entry per field of the definition, with key and value:

The entries row with handle and fields
  • The field keys label and hex must match the fields of your definition. Further fields are prepared as deactivated examples (text, boolean, date, dimension, volume, references, colour, JSON); activate and adjust the ones you need.
  • Field values can use references as in metafields, e.g. @productRef:<PIM identifier> or @metaobjectRef:<type>|<handle>; see Shopify Metafield Field Plugin.
  • Status (ACTIVE or DRAFT) and template suffix of an entry are prepared under capabilities, deactivated. Activate them only for definitions with these capabilities; a capability the definition lacks fails the entry.

Status and template suffix: available from 1.21.20 (key metaobjectInput). The key metaobject of older datamaps keeps working, but ignores them.

Colour codes

A value range has no field for a colour code. Create a transformation list (value’s external key → hex code, e.g. #C62828), select it in the prepared colour field, and activate the field.

Transformation list from external key to hex code
Metaobject entries in Shopify

Important: Shopify accepts colour codes with six digits only: #FFFFFF, not #FFF.

Deleting entries

The node mapping metaobjectDelete reads the same data as the export, so it is deactivated. For a delete run, activate it and deactivate metaobjectUpdateCreate, run the job, then switch both back. It deletes the entries of all values of the selected attributes.

Important:

  • Shopify does not delete entries that are still used as values of a product option, and reports no error. The job log shows a warning for each of them (from 1.21.19). Remove them from the products first.
  • A value that was removed from the value range is no longer in the data, so its entry cannot be deleted this way. Delete it in Shopify.
Was this article helpful?
How can we improve this article?
Please submit the reason for your vote so that we can improve the article.
Table of Contents