MetafieldsVariant Metafields

Variant Metafields

This page documents all variant-level metafields populated by PromoSync. These fields are attached to individual product variants. All fields use the psrestful namespace.

For detailed object schemas, refer to the PSRESTful Product Data 2.0.0 documentation.

Accessing Variant Metafields

In Liquid Templates

{% raw %}{% for variant in product.variants %}
  {% assign part_id = variant.metafields.psrestful.part_id %}
  <option value="{{ variant.id }}" data-part-id="{{ part_id }}">
    {{ variant.title }}
  </option>
{% endfor %}{% endraw %}

In JavaScript

const variantMetafields = variant.metafields?.psrestful;
if (variantMetafields) {
  console.log(variantMetafields.part_id);
}

Identification

part_id

PromoStandards Part ID (supplier variant identifier).

PropertyValue
Namespacepsrestful
Keypart_id
Typesingle_line_text_field
{% raw %}{{ variant.metafields.psrestful.part_id }}
→ "3001-BLK-L"{% endraw %}

variant_gtin

Global Trade Item Number (barcode/UPC).

PropertyValue
Namespacepsrestful
Keyvariant_gtin
Typesingle_line_text_field
{% raw %}{{ variant.metafields.psrestful.variant_gtin }}
→ "882932789234"{% endraw %}

Pricing

part_price_array

Array containing pricing information for the variant with quantity breaks.

PropertyValue
Namespacepsrestful
Keypart_price_array
Typejson

See PartPrice Object for the complete schema.

{% raw %}{% assign pricing = variant.metafields.psrestful.part_price_array.value %}
{% if pricing %}
  <!-- Access pricing tiers -->
{% endif %}{% endraw %}

Physical Attributes

dimension

Product dimensions for the variant.

PropertyValue
Namespacepsrestful
Keydimension
Typejson

See Dimension Object for the complete schema.

{% raw %}{% assign dim = variant.metafields.psrestful.dimension.value %}
{% if dim %}
  <!-- Access dimension properties -->
{% endif %}{% endraw %}

apparel_size

Product apparel size information.

PropertyValue
Namespacepsrestful
Keyapparel_size
Typejson

See ApparelSize Object for the complete schema.

Fields include:

  • apparelStyle - Unisex, Youth, Girls, Boys, Womens, WomensTall, Mens, MensTall
  • labelSize - OSFA, 4XS through 5XL, or CUSTOM
  • customSize - Used when labelSize is CUSTOM
{% raw %}{% assign size = variant.metafields.psrestful.apparel_size.value %}
{% if size %}
  <span>{{ size.labelSize }} ({{ size.apparelStyle }})</span>
{% endif %}{% endraw %}

Specifications

specification_array

Array of product specifications for the variant.

PropertyValue
Namespacepsrestful
Keyspecification_array
Typejson

See Specification Object for the complete schema.

{% raw %}{% assign specs = variant.metafields.psrestful.specification_array.value %}
{% if specs %}
  {% for spec in specs %}
    <!-- Access specification properties -->
  {% endfor %}
{% endif %}{% endraw %}

color_array

Color information array for the variant.

PropertyValue
Namespacepsrestful
Keycolor_array
Typejson

See Color Object for the complete schema.

{% raw %}{% assign colors = variant.metafields.psrestful.color_array.value %}
{% if colors %}
  {% for color in colors %}
    <!-- Access color properties like colorName, hex -->
  {% endfor %}
{% endif %}{% endraw %}

Packaging

product_package_array

Product packaging information for the variant.

PropertyValue
Namespacepsrestful
Keyproduct_package_array
Typejson

See ProductPackage Object for the complete schema.

{% raw %}{% assign packages = variant.metafields.psrestful.product_package_array.value %}
{% if packages %}
  {% for pkg in packages %}
    <!-- Access package properties -->
  {% endfor %}
{% endif %}{% endraw %}

shipping_package_array

Shipping package information (e.g., master carton details).

PropertyValue
Namespacepsrestful
Keyshipping_package_array
Typejson

See ShippingPackage Object for the complete schema.

{% raw %}{% assign shipping = variant.metafields.psrestful.shipping_package_array.value %}
{% if shipping %}
  {% for carton in shipping %}
    <!-- Access shipping package properties -->
  {% endfor %}
{% endif %}{% endraw %}

Complete Variant Metafield List

KeyTypeDescriptionSchema Reference
part_idtextPromoStandards Part ID-
variant_gtintextGlobal Trade Item Number-
part_price_arrayjsonPricing with quantity breaksPartPrice
dimensionjsonPhysical dimensionsDimension
apparel_sizejsonApparel size infoApparelSize
specification_arrayjsonVariant specificationsSpecification
color_arrayjsonColor informationColor
product_package_arrayjsonProduct packagingProductPackage
shipping_package_arrayjsonShipping/carton infoShippingPackage

Storefront API Access

To access variant metafields via Storefront API:

query VariantMetafields($productId: ID!) {
  product(id: $productId) {
    variants(first: 100) {
      edges {
        node {
          id
          title
          metafield(namespace: "psrestful", key: "part_id") {
            value
          }
          colorArray: metafield(namespace: "psrestful", key: "color_array") {
            value
          }
        }
      }
    }
  }
}

Ensure metafields have Storefront API access enabled in Settings > Custom data.