Metafields is a great tool to store additional information and display custom content on individual pages of your Shoplazza store. By associating custom data with products, collections, and other objects. You can read the Metafields Guide for more information.
The Metafield API allows developers to store, retrieve, and manage custom metadata for various resources such as products, collections, orders, and more. It provides a flexible way to add custom fields, enabling merchants to meet specific business needs.
Metafield Overview
Metafields are key-value pairs associated with resources. Each metafield can have a namespace and type to ensure clear organization and avoid conflicts.
Data Types
Metafields support diverse data types, such as:
- Strings, integers, and decimals: Basic values.
- JSON: Structured data.
- Files, URLs, and colors: Specific use cases.
- Date and time: Scheduling or logging.
- Boolean values: True/false scenarios.
Owner Resources
Metafields can be associated with various resources, including:
- Products and product variants.
- Collections, pages, blogs, and articles.
- Orders, customers, and shops.
Comparison of Metafield, Material File, and Image
Feature | Metafield | Material File | Image |
---|---|---|---|
Supported Content Types | Text, numbers, colors, file links, dates, images, etc. | Images only | Images only |
Flexibility | High, suitable for extending fields and dynamic binding | Moderate, designed for managing image libraries | Low, used for direct image display |
Adaptation Scope | Product details pages, collection details pages, dynamic field configurations | Material library management and reusable images | Product images, front-end theme image display |
Use Case | Dynamic field configuration, complex content display | Managing and reusing image assets | Simple product or theme image display |
Key Notes
-
Metafield:
- Ideal for cases requiring dynamic binding, custom fields, or displaying diverse content types.
- Example: Adding material descriptions, usage instructions, or supplementary visuals to product or collection details pages.
-
Material File:
- Specifically for image resource management, allowing centralized image uploads and reuse across various parts of the store.
- Example: Managing banners, logos, or reusable images in the admin.
-
Image:
- Best suited for directly displaying product or theme images without dynamic or complex content binding.
- Example: Displaying product pictures or static images in themes.