Shopify Metafields & Metaobjects Overview
memberr uses Shopify's metafields and metaobjects to store and manage various types of data. This documentation provides a comprehensive overview of how these systems work together.
Quick Navigation
Metafields
Metafields store simple, single-value data points:
Metafield Context | Description |
---|---|
Shop Metafields | Organization settings and configuration |
Customer Metafields | Customer-specific data like balances and membership status |
Metaobjects
Metaobjects store complex, structured data that of multiple fields:
Metafield Context | Description |
---|---|
Memberships | Membership tiers and their benefits |
Birthday Reward Program | Birthday rewards configuration |
Cashback Program | Cashback rewards settings |
Referral Program | Referral system configuration |
Review Reward Program | Review rewards setup |
Understanding the Architecture
Metafields vs. Metaobjects
Metafields | Metaobjects |
---|---|
Single-value data storage | Complex, multi-field data structures |
Simple types (text, number, money, JSON) | Can reference other metaobjects |
Attached to existing Shopify resources (shop, customer) | Stand-alone entities |
Used for configuration and customer-specific data | Used for program configurations and complex data relationships |
Example usage metafield:
_10{{ shop.metafields.app--60169453569--memberr_v2.organization_id }}
Example usage metaobject:
_10{%- assign membership = shop.metaobjects.app--60169453569--membership.v2 -%}
Common Patterns
Accessing Data
-
Shop Configuration:
_10{{ shop.metafields.app--60169453569--memberr_v2.FIELD_NAME }} -
Program Configuration:
_10{%- assign program = shop.metaobjects.app--60169453569--PROGRAM_TYPE.v2 -%} -
Customer Data:
_10{{ customer.metafields.app--60169453569--memberr_v2.FIELD_NAME }}
Best Practices
Always check existence before accessing:
_10{% if shop.metafields.app--60169453569--memberr_v2.field_name %}_10 <!-- Access field -->_10{% endif %}
Always use the money filter with .value for balance fields:
_10{{ money_field.value | money }}
Use proper namespace:
_10app--60169453569--memberr_v2
Data Types
Common Metafield Types
Field Type | Description |
---|---|
text | Text values |
money | Monetary values |
json | Structured data |
boolean | true/false values |
Common Metaobject Fields
Field | Description |
---|---|
is_active | Program activation status |
membership_id | References to memberships |
Money amounts | always use .value to access |
Time periods | in days |
Security Considerations
Public vs. Private Access
- Some fields are publicly readable
- Sensitive data is restricted
- Always check access levels in documentation
Customer Data Protection
- Customer metafields are scoped to individual customers
- Membership data is properly segmented
- Balances are securely managed
Getting Started
- Start with Shop Metafields for basic configuration
- Understand Customer Metafields for user data
- Explore individual program documentation for specific features
- Reference best practices when implementing