Metadata
Overview
Metadata is a way to add additional information to Spree objects. There are two types of metadata:
Public Metadata
Public metadata is available via Storefront API without any authentication. It is stored in the public_metadata
JSONB column of the table. This kind of metadata should be only used for public information that is visible to all users, eg. additional information about the object.
Private Metadata
Private metadata is only available via Platform API and requires authentication. It is stored in the private_metadata
JSONB column of the table. This kind of metadata should be only used for private information that is not visible to the public, eg. IDs in external systems, private notes, etc.
Usage
Adding metadata to an object
Fetching metadata from an object
Querying objects by metadata
For Products it’s recommended to use Properties or Option Types instead of Metadata.
Was this page helpful?