This is related to Admin Intent documentation Metaobject Definitions has wrong params
I discovered couple more inconstancies. Admin Intents docs for Metaobjects and Metaobject Definition don’t describe the usage correctly.
- Edit MetaobjectDefinition Intent
Official Docs (WRONG):
const activity = await shopify.intents.invoke(
‘edit:shopify/MetaobjectDefinition’,
{ value: ‘gid://shopify/MetaobjectDefinition/123456789’ }
);
Correct Implementation:
const activity = await window.shopify.intents.invoke(
“edit:shopify/MetaobjectDefinition”,
{
data: { type: selectedDefinition }, // e.g., ‘shopify–color-pattern’
}
);
Difference: The official docs claim you need to pass a value with the GID of the metaobject definition. The correct implementation use
data: { type } instead, where type is the metaobject definition type string (e.g., ‘shopify–color-pattern’), not a GID.
- Edit Metaobject Intent
Official Docs (WRONG - Incomplete):
const activity = await shopify.intents.invoke(‘edit:shopify/Metaobject’, {
value: ‘gid://shopify/Metaobject/123456789’,
data: {type: ‘shopify–color-pattern’},
});
Correct Implementation:
const activity = await window.shopify.intents.invoke(
“edit:shopify/Metaobject”,
{
value: metaobject.id, // GID of metaobject
data: { type: metaobjectType }, // REQUIRED type
}
);
Difference: The official docs show data: { type } in their table but their examples are inconsistent. The correct implementation requires BOTH value (the metaobject GID) AND data: { type } (the definition type).
Also faced by @farid
- Create MetaobjectDefinition Intent
Official Docs:
const activity = await shopify.intents.invoke(
‘create:shopify/MetaobjectDefinition’,
);
Correct Implementation:
const activity = await window.shopify.intents.invoke(
“create:shopify/MetaobjectDefinition”
);
Difference: None - both are correct. No additional parameters needed.
- Create Metaobject Intent
Official Docs (Correct):
const activity = await shopify.intents.invoke(‘create:shopify/Metaobject’, {
data: {type: ‘shopify–color-pattern’},
});
Correct Implementation
const activity = await window.shopify.intents.invoke(
“create:shopify/Metaobject”,
{
data: { type: selectedDefinition },
}
);
Difference: None - both are correct.
Summary Table
| Intent | Parameter | Official Docs | Your Code | Status |
|---|---|---|---|---|
| edit:shopify/MetaobjectDefinition | Required | Docs Wrong | ||
| edit:shopify/Metaobject | Required | Docs Incomplete | ||
| create:shopify/MetaobjectDefinition | Required | Correct | ||
| create:shopify/Metaobject | Required | Correct |
Critical Insight
The metaobject definition type (e.g., ‘shopify–color-pattern’) is ALWAYS required when working with metaobjects, even for edit operations. This makes sense because Shopify’s metaobject editor UI needs to know which definition schema to load for the editing interface.
The official Shopify docs are misleading/incorrect for the edit:shopify/MetaobjectDefinition intent pattern.