MetafieldsVariant Metafields

Variant Metafields

This page lists the variant-level metafields PromoSync writes. They are attached to individual product variants and use the psrestful namespace. A key is only written when the supplier (or a PromoSync rule) provides a value for it.

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

Variant metafields are not part of Shopify’s product JSON. Serialize the ones you need into the page from Liquid, or read them through the Storefront API (see Storefront API Access).

{% raw %}<script type="application/json" id="variant-part-ids">
  { {% for v in product.variants %}"{{ v.id }}": {{ v.metafields.psrestful.part_id | json }}{% unless forloop.last %},{% endunless %}{% endfor %} }
</script>{% endraw %}

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

The variant’s tier prices: one entry per quantity break, sorted by quantity. This is PromoSync’s own format, not the PromoStandards price object: quantityMin is the break quantity and price is the unit price in cents. Tiers priced at 0 are dropped. When a Tier Pricing Rule matches the product, the rule’s tiers are written instead of the supplier’s.

PropertyValue
Namespacepsrestful
Keypart_price_array
Typejson

Example value:

[
  {"quantityMin": 144, "price": 610},
  {"quantityMin": 288, "price": 530},
  {"quantityMin": 576, "price": 461},
  {"quantityMin": 1008, "price": 401},
  {"quantityMin": 2016, "price": 349}
]

Note: Prices are integers in cents: 610 means $6.10. Shopify’s money filter already expects cents, so pass the value straight to it.

{% raw %}{% assign pricing = variant.metafields.psrestful.part_price_array.value %}
{% if pricing %}
  <table class="tier-pricing">
    {% for tier in pricing %}
      <tr>
        <td>{{ tier.quantityMin }}+</td>
        <td>{{ tier.price | money }}</td>
      </tr>
    {% endfor %}
  </table>
{% endif %}{% endraw %}

blank_part_price_array and sample_price

Tier prices for the blank (undecorated) version of the variant, in the same format as part_price_array, and sample_price: the single-unit blank price in cents, written only when the first blank tier starts at quantity 1. Both are only written on shops where the PromoSync team has turned on blank and sample sales and whose default configuration is Decorated.

KeyType
blank_part_price_arrayjson
sample_pricenumber_integer

msrp

The supplier’s list price (MSRP) at the variant’s lowest quantity tier, in your store currency, whatever pricing method sets the Shopify price. Only written when Save MSRP Metafields is on in PromoSync settings, and only when the supplier publishes a list price. It has storefront access and can be used in automated collection rules.

PropertyValue
Namespacepsrestful
Keymsrp
Typenumber_decimal

Physical Attributes

dimension

Product dimensions for the variant.

PropertyValue
Namespacepsrestful
Keydimension
Typejson

See Dimension Object for the complete schema.

Example value:

{
  "dimensionUom": "IN",
  "depth": "3.45",
  "height": "6.8",
  "width": "3.45",
  "weightUom": "LB",
  "weight": "0.7"
}
{% raw %}{% assign dim = variant.metafields.psrestful.dimension.value %}
{% if dim %}
  <div class="dimensions">
    {{ dim.depth }}×{{ dim.width }}×{{ dim.height }} {{ dim.dimensionUom }},
    {{ dim.weight }} {{ dim.weightUom }}
  </div>
{% 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.

Example value:

[
  {
    "specificationType": "Length",
    "SpecificationUom": "Inches",
    "measurementValue": "18 1/8"
  },
  {
    "specificationType": "Chest",
    "SpecificationUom": "Inches",
    "measurementValue": "19 1/4"
  }
]
{% raw %}{% assign specs = variant.metafields.psrestful.specification_array.value %}
{% if specs %}
  <ul class="specifications">
    {% for spec in specs %}
      <li>{{ spec.specificationType }}: {{ spec.measurementValue }} {{ spec.SpecificationUom }}</li>
    {% endfor %}
  </ul>
{% endif %}{% endraw %}

color_array

Color information array for the variant.

PropertyValue
Namespacepsrestful
Keycolor_array
Typejson

See Color Object for the complete schema.

Example value:

[
  {
    "colorName": "Taupe",
    "hex": null,
    "approximatePms": "407C",
    "standardColorName": "Grey"
  }
]
{% raw %}{% assign colors = variant.metafields.psrestful.color_array.value %}
{% if colors %}
  {% for color in colors %}
    <span style="color: {{ color.hex | default: '#000' }}">
      {{ color.colorName }} ({{ color.standardColorName }})
    </span>
  {% 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.

Example value:

[
  {
    "packageType": "Carton",
    "description": null,
    "quantity": 18.0,
    "dimensionUom": "IN",
    "depth": 17.0,
    "height": 14.0,
    "width": 14.0,
    "weightUom": "LB",
    "weight": 14.0
  }
]
{% raw %}{% assign shipping = variant.metafields.psrestful.shipping_package_array.value %}
{% if shipping %}
  {% for carton in shipping %}
    <div class="shipping-info">
      <strong>{{ carton.packageType }}</strong>:
      {{ carton.quantity }} units per carton
      ({{ carton.depth }}×{{ carton.width }}×{{ carton.height }} {{ carton.dimensionUom }},
      {{ carton.weight }} {{ carton.weightUom }})
    </div>
  {% endfor %}
{% endif %}{% endraw %}

Media

Color-matched, multi-image gallery for the variant. The first item is the variant’s featured image; subsequent items are additional views (front, back, side, lifestyle) of the same color.

PropertyValue
Namespacepsrestful
Keygallery
Typelist.file_reference

Written only for shops with the Merchandising bundle (PSRESTful Trial, Business or Enterprise, or Premium with the Merchandising add-on), and never on shops that split variants by color. See the Per-Variant Media Gallery guide for plan eligibility, Liquid examples, and theme integration.

Decoration Product Variants

The shared decoration products PromoSync creates (vendor PromoSync, see Decoration Listings) have one variant per pricing class. Those variants carry:

KeyTypeDescription
pricing_hashtextStable ID of the pricing class
suppliersjsonSupplier codes this pricing class applies to
part_price_arrayjsonRun-charge ladder, on run charge variants
setup_tier_arrayjsonPer-color or per-stitch setup ladder, on per-unit setup variants. Has storefront access

Complete Variant Metafield List

KeyTypeDescriptionSchema Reference
part_idtextPromoStandards Part ID-
variant_gtintextGlobal Trade Item Number-
part_price_arrayjsonTier prices, in centsPromoSync format (see above)
blank_part_price_arrayjsonBlank tier prices (staff-enabled blank and sample sales only)PromoSync format
sample_priceintegerSingle-unit blank price in cents (same condition)-
msrpdecimalSupplier list price (only with Save MSRP Metafields)-
dimensionjsonPhysical dimensionsDimension
apparel_sizejsonApparel size infoApparelSize
specification_arrayjsonVariant specificationsSpecification
color_arrayjsonColor informationColor
product_package_arrayjsonProduct packagingProductPackage
shipping_package_arrayjsonShipping/carton infoShippingPackage
gallerylist.file_referenceColor-matched variant images (Merchandising bundle only)Guide
pricing_hash, suppliers, setup_tier_arrayvariousDecoration product variants onlyDecoration Listings

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
          }
        }
      }
    }
  }
}

The Storefront API only returns metafields whose definition has storefront access. PromoSync turns it on for part_price_array, setup_tier_array and msrp. For other keys, such as part_id and color_array in the example above, turn it on yourself under Settings > Metafields and metaobjects > Variants in your Shopify admin.