Skip to content

Instantly share code, notes, and snippets.

@jaredkc
Last active October 20, 2025 16:21
Show Gist options
  • Save jaredkc/523a024ea50f957a25f12e266583c974 to your computer and use it in GitHub Desktop.
Save jaredkc/523a024ea50f957a25f12e266583c974 to your computer and use it in GitHub Desktop.
Shopify "Press reviews"

Important: You'll need to replace YOUR_METAOBJECT_DEFINITION_ID with the actual ID of the "Press reviews" metaobject definition from the target store. After you create the metaobject definition using the first mutation I provided, you'll get back an ID that you can use here in the validation value.

This metafield allows you to attach a list of press review metaobjects to your products, making it accessible from both the admin and your storefront.

Or, you can look up the ID with this GraphQL query:

query GetPressReviewsMetaobjectDefinitionId {
  metaobjectDefinitionByType(type: "press_reviews") {
    id
    name
    type
  }
}
mutation CreatePressReviewsMetaobject {
metaobjectDefinitionCreate(definition: {
name: "Press reviews"
type: "press_reviews"
description: ""
displayNameKey: "title"
access: {
storefront: PUBLIC_READ
}
capabilities: {
publishable: {
enabled: true
}
translatable: {
enabled: true
}
}
fieldDefinitions: [
{
name: "Title"
key: "title"
description: "Format: \"product - review title\""
type: "single_line_text_field"
required: true
}
{
name: "Quote"
key: "quote"
type: "rich_text_field"
required: true
}
{
name: "Source"
key: "source"
type: "single_line_text_field"
required: false
}
{
name: "link"
key: "link"
type: "url"
required: false
}
{
name: "Product"
key: "product"
type: "product_reference"
required: false
}
]
}) {
metaobjectDefinition {
id
name
type
}
userErrors {
field
message
code
}
}
}
mutation CreatePressReviewsMetafieldDefinition {
metafieldDefinitionCreate(definition: {
name: "Press reviews"
namespace: "custom"
key: "press_reviews"
description: ""
type: "list.metaobject_reference"
ownerType: PRODUCT
validations: [
{
name: "metaobject_definition_id"
value: "gid://shopify/MetaobjectDefinition/YOUR_METAOBJECT_DEFINITION_ID"
}
]
access: {
storefront: PUBLIC_READ
}
}) {
createdDefinition {
id
name
namespace
key
}
userErrors {
field
message
code
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment