MetafieldsMetafields Overview

Metafields Overview

PromoSync populates 70+ metafields with rich product data from PromoStandards suppliers. This data enables advanced storefront features, custom displays, and integrations.

What Are Metafields?

Shopify metafields are custom data fields that extend product information beyond standard fields. PromoSync uses metafields to store:

  • Pricing tiers and quantity breaks
  • Decoration options and locations
  • Product specifications
  • Supplier information
  • Google Merchant Center data

Namespace and Access

All PromoSync metafields use the psrestful namespace:

{% raw %}{{ product.metafields.psrestful.tier_pricing }}
{{ product.metafields.psrestful.specifications }}{% endraw %}

Metafield Categories

Product Metafields

Fields attached to the product level:

  • Basic info (brand, supplier, category)
  • Pricing data (tier pricing, MAP)
  • Specifications (materials, dimensions)
  • Media (images, videos, documents)
  • Decoration options

Variant Metafields

Fields attached to individual variants:

  • Color and size details
  • UPC/GTIN barcodes
  • Variant-specific inventory
  • Pricing overrides

Google Merchant Fields

Fields for Google Shopping integration:

  • Product identifiers (GTIN, MPN)
  • Categorization (product type, category)
  • Attributes (age group, gender, material)
  • Custom labels

Quick Reference

Most Used Metafields

MetafieldTypeDescription
tier_pricingJSONQuantity-based pricing tiers
specificationsJSONProduct specs and features
location_decorationsJSONAvailable decoration options
brandStringProduct brand name
supplierStringSupplier name
inventory_dataJSONDetailed inventory information

Google Merchant Fields

FieldShopify NamespaceDescription
Brandgoogle.custom.brandProduct brand
GTINgoogle.custom.gtinBarcode
MPNgoogle.custom.mpnManufacturer part number
Conditiongoogle.custom.conditionProduct condition

Accessing Metafields in Liquid

Basic Access

{% raw %}{% assign brand = product.metafields.psrestful.brand %}
{% if brand %}
  <span class="product-brand">{{ brand }}</span>
{% endif %}{% endraw %}

JSON Metafields

For complex data stored as JSON:

{% raw %}{% assign specs = product.metafields.psrestful.specifications.value %}
{% if specs %}
  <p>Material: {{ specs.material }}</p>
  <p>Weight: {{ specs.weight }}</p>
{% endif %}{% endraw %}

Variant Metafields

Access variant-level data:

{% raw %}{% assign color_info = variant.metafields.psrestful.color_info.value %}
{% if color_info %}
  <span style="background: {{ color_info.hex }};">{{ color_info.name }}</span>
{% endif %}{% endraw %}

Accessing Metafields via API

Storefront API

query ProductMetafields($handle: String!) {
  product(handle: $handle) {
    metafield(namespace: "psrestful", key: "tier_pricing") {
      value
    }
  }
}

Admin API

query {
  product(id: "gid://shopify/Product/123456") {
    metafields(first: 10, namespace: "psrestful") {
      edges {
        node {
          key
          value
        }
      }
    }
  }
}

Metafield Definitions

PromoSync creates metafield definitions automatically. To view them:

  1. Go to Settings > Custom data in Shopify admin
  2. Click Products or Variants
  3. Filter by namespace psrestful

Benefits of Definitions

  • Type validation for metafield values
  • Storefront API access
  • Theme editor integration
  • GraphQL schema typing

Data Freshness

Metafields are updated:

EventWhat Updates
Product ImportAll metafields
Inventory Syncinventory_data only
Pricing UpdatePricing-related metafields
Full RefreshAll metafields

Check the last_sync metafield for timestamps:

{% raw %}{% assign sync = product.metafields.psrestful.last_sync %}
Last updated: {{ sync | date: "%B %d, %Y at %I:%M %p" }}{% endraw %}

Common Use Cases

1. Display Tier Pricing

Show quantity breaks and pricing on product pages. → See Storefront Widgets

2. Custom Decoration Options

Display available imprint locations and methods. → See Location Decorations

3. Google Shopping Feed

Feed product data to Google Merchant Center. → See Google Merchant Fields

4. Custom Product Filters

Create collection filters based on specifications. → Use specification metafields in collection filtering

5. Inventory Displays

Show warehouse availability or stock status. → Access inventory_data metafield

Performance Considerations

Storefront API Access

Not all metafields are exposed to Storefront API by default. To enable access:

  1. Go to Settings > Custom data
  2. Find the metafield definition
  3. Enable Storefront API access

Caching

Metafield data is cached by Shopify. After updates:

  • Storefront data updates within minutes
  • Theme previews may need refresh
  • API responses update immediately

Troubleshooting

Metafield Not Showing

  1. Verify the product was synced
  2. Check the correct namespace (psrestful)
  3. Ensure metafield definition exists
  4. Check Storefront API access settings

Data is Outdated

  1. Check last_sync timestamp
  2. Trigger manual sync
  3. Verify supplier connection

JSON Parse Errors

When accessing JSON metafields:

{% raw %}{% comment %} Use .value for parsed JSON {% endcomment %}
{% assign data = product.metafields.psrestful.specifications.value %}
 
{% comment %} Not raw JSON string {% endcomment %}
{% assign data = product.metafields.psrestful.specifications %}{% endraw %}

Next Steps