Metafield

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

FeatureMetafieldMaterial FileImage
Supported Content TypesText, numbers, colors, file links, dates, images, etc.Images onlyImages only
FlexibilityHigh, suitable for extending fields and dynamic bindingModerate, designed for managing image librariesLow, used for direct image display
Adaptation ScopeProduct details pages, collection details pages, dynamic field configurationsMaterial library management and reusable imagesProduct images, front-end theme image display
Use CaseDynamic field configuration, complex content displayManaging and reusing image assetsSimple 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.