Adding Custom Data to Products and Collections
Custom Fields for Products, Collections, and More
Custom Data lets you store extra information on your products, collections, orders, and customers beyond Cartly's built-in fields. For example, you could add a "Material" field to every product or a "Lead Time" field to collections.
What Are Metafields?
Metafields are key-value pairs attached to a Cartly entity. A product could have a metafield in the custom namespace with the key material and the value 100% cotton. You decide the structure; Cartly stores and validates the data.
Setting Up a Field Definition
Navigate to Settings ā Custom Data and select the entity type (Products, Collections, Orders, or Customers). Click Add Definition and fill in:
- Name ā Human-readable label shown in the admin (e.g., "Material")
- Namespace ā A grouping prefix, usually
customfor your own fields - Key ā The field identifier used in Liquid and the API (e.g.,
material) - Type ā The data type: text, number, boolean, date, color, URL, file, or a reference to another product/collection/metaobject
Once a definition exists, Cartly validates every value written to that field. For example, a number_integer field will reject a text value.
Editing Metafield Values
After defining fields, they appear at the bottom of every product (or collection, order, customer) edit page. Simply fill them in and save as normal.
Using Metafields in Your Theme
Metafields are available in Liquid templates as {{ product.metafields.custom.material }}. Install a theme that references custom fields, or add the output to your Liquid sections manually.
What Are Metaobjects?
Metaobjects are custom content types ā like a mini CMS for structured records. Navigate to Content ā Custom Content to create a definition (e.g., "Designer Profile") with multiple typed fields, then add entries (e.g., one entry per designer). You can link products to designer entries via a metaobject_reference metafield.
Metaobject Use Cases
- Designer or brand profiles linked to products
- Size guide tables with columns and rows
- FAQ entries displayed on product pages
- Testimonials or team member profiles
API and GraphQL Access
Metafields and metaobjects are accessible via the Cartly REST API and GraphQL Storefront API, making them available to custom storefronts and third-party apps.