Menu
metafieldDefinitions
Query metafield definitions — supports a search `query`, `sortKey`, and cursor paging.
Use it in a workflow
- Add a step and choose the Shopify connector.
- Pick the metafieldDefinitions action (under Metafield).
- Fill in the fields below, then reference the result from later steps as
{{metafielddefinitions.response.data}}.
Query
This is the query the action sends by default. Edit it in the step's Query field to change which fields come back.
query MetafieldDefinitions($key: String, $namespace: String, $ownerType: MetafieldOwnerType!, $pinnedStatus: MetafieldDefinitionPinnedStatus, $constraintSubtype: MetafieldDefinitionConstraintSubtypeIdentifier, $constraintStatus: MetafieldDefinitionConstraintStatus, $first: Int, $after: String, $last: Int, $before: String, $reverse: Boolean, $sortKey: MetafieldDefinitionSortKeys, $query: String) {
metafieldDefinitions(
key: $key
namespace: $namespace
ownerType: $ownerType
pinnedStatus: $pinnedStatus
constraintSubtype: $constraintSubtype
constraintStatus: $constraintStatus
first: $first
after: $after
last: $last
before: $before
reverse: $reverse
sortKey: $sortKey
query: $query
) {
edges {
cursor
node {
access
capabilities
constraints
description
id
key
name
namespace
ownerType
pinnedPosition
standardTemplate
type
useAsCollectionCondition
validationStatus
validations
}
}
nodes {
access {
admin
customerAccount
storefront
}
capabilities {
adminFilterable
analyticsQueryable
cartToOrderCopyable
smartCollectionCondition
uniqueValues
}
constraints {
key
}
description
id
key
name
namespace
ownerType
pinnedPosition
standardTemplate {
description
id
key
name
namespace
ownerTypes
type
validations
visibleToStorefrontApi
}
type {
category
name
supportedValidations
supportsDefinitionMigrations
valueType
}
useAsCollectionCondition
validationStatus
validations {
name
type
value
}
}
pageInfo {
endCursor
hasNextPage
hasPreviousPage
startCursor
}
}
}
Variables
Pass these as a JSON object in the step's Variables field.
{
"ownerType": "API_PERMISSION",
"key": "string",
"namespace": "string",
"pinnedStatus": "ANY",
"constraintSubtype": {
"key": "string",
"value": "string"
},
"constraintStatus": "CONSTRAINED_AND_UNCONSTRAINED",
"first": 0,
"after": "string",
"last": 0,
"before": "string",
"reverse": false,
"sortKey": "ID"
}
Response
Read the result with {{metafielddefinitions.response.data.data.metafieldDefinitions}}. If the API returns errors, the step fails and they are at {{metafielddefinitions.response.data.errors}}.
Need more? See the Shopify guide for connection setup and behaviour shared by every action.
Was this page helpful?