Manage metaobjects
Metaobjects enable merchants and developers to define custom objects in Shopify. This guide shows you how to get started with creating and managing metaobjects and metaobject definitions using the GraphQL Admin API.
What you'll learn
Anchor link to section titled "What you'll learn"In this tutorial, you'll learn how to do the following tasks:
- Define metaobjects
- Create metaobject entries
Requirements
Anchor link to section titled "Requirements"- Your app can make authenticated requests to the GraphQL Admin API.
- You're using API version 2023-01 or higher.
You want your app to offer a way for merchants to create highlights for products they're creating. Merchants might want to showcase the quality of their goods or interesting facts about the product.
Step 1: Define a product highlight metaobject
Anchor link to section titled "Step 1: Define a product highlight metaobject"Before merchants can start creating highlights, your app will need to tell Shopify what a product highlight is. Shopify doesn't have a product highlight resource, so you need to define one using the metaobjectDefinitionCreate
mutation:
Step 2: Create a product highlight metaobject entry
Anchor link to section titled "Step 2: Create a product highlight metaobject entry"After defining what a product highlight is, you can create entries or instances of your product highlights using the metaobjectCreate
mutation:
Step 3: Retrieve your product highlights
Anchor link to section titled "Step 3: Retrieve your product highlights"With your product highlight entry now created, you can read it back from the API using the metaobjects
paginated query to retrieve all of your highlights:
You can also retrieve a single metaobject by its handle using the metaobjectByHandle
query:
Next steps (optional)
Anchor link to section titled "Next steps (optional)"- Learn more about access controls.
- Learn about metaobject capabilities.