shopify-metafields

Metafields allow you to store additional data on Shopify resources (Products, Orders, Customers, Shops) that aren't included in the default schema (e.g., "washing instructions" for a product).

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "shopify-metafields" with this command: npx skills add toilahuongg/shopify-agents-kit/toilahuongg-shopify-agents-kit-shopify-metafields

Shopify Metafields

Metafields allow you to store additional data on Shopify resources (Products, Orders, Customers, Shops) that aren't included in the default schema (e.g., "washing instructions" for a product).

  1. Concepts
  • Namespace: Grouping folder (e.g., my_app , global ).

  • Key: Specific field name (e.g., washing_instructions ).

  • Type: Data type (e.g., single_line_text_field , number_integer , json ).

  • Owner: The resource attaching the data (Product ID, Shop ID).

  1. Metafield Definitions (Standard)

Always use Metafield Definitions (pinned metafields) when possible. This integrates them into the Admin UI and ensures standard processing.

  • Create: Settings > Custom Data > [Resource] > Add definition.

  • Access: namespace.key

  1. Accessing in Liquid

To display metafield data on the Storefront:

<!-- Accessing a product metafield --> <p>Washing: {{ product.metafields.my_app.washing_instructions }}</p>

<!-- Accessing a file/image metafield --> {% assign file = product.metafields.my_app.size_chart.value %} <img src="{{ file | image_url: width: 500 }}" />

<!-- Checking existence --> {% if product.metafields.my_app.instructions != blank %} ... {% endif %}

  1. Reading via API (GraphQL)

query { product(id: "gid://shopify/Product/123") { title metafield(namespace: "my_app", key: "instructions") { value type } } }

  1. Writing via API (GraphQL)

To create or update a metafield, use metafieldsSet .

mutation metafieldsSet($metafields: [MetafieldsSetInput!]!) { metafieldsSet(metafields: $metafields) { metafields { id namespace key value } userErrors { field message } } }

/* Variables */ { "metafields": [ { "ownerId": "gid://shopify/Product/123", "namespace": "my_app", "key": "instructions", "type": "single_line_text_field", "value": "Wash cold, tumble dry." } ] }

  1. Private Metafields

If you want data to be hidden from other apps and the storefront, use Private Metafields. Note: These cannot be accessed via Liquid directly.

  • Use privateMetafield queries/mutations.

  • Requires explicit read_private_metafields / write_private_metafields scope (rarely used now, app_data metafields are preferred for app-specific valid storage).

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Automation

shopify-api

No summary provided by upstream source.

Repository SourceNeeds Review
Automation

shopify-extensions

No summary provided by upstream source.

Repository SourceNeeds Review
Automation

shopify-functions

No summary provided by upstream source.

Repository SourceNeeds Review
Automation

shopify-webhooks

No summary provided by upstream source.

Repository SourceNeeds Review