shopify app function target-level input variables
Introduced 2026-10-08 · score 0.97
HOW TO USE IT
When a function target’s input query declares variables, set `input_variables` on that target to identify its JSON metafield. Don’t also configure extension-level variables in the same function.
[[extensions.targeting]]
target = "<function-target>"
input_query = "<path-to-input-query.graphql>"
input_variables = { namespace = "$app:<namespace>", key = "<key>" }
export = "<function-export>"WHY THIS HELPS
Configure different input query variables for targets in a Shopify function extension.
BEFORE THIS CHANGE
Extension-level `[extensions.input.variables]` applied one metafield to every target; older configuration files used `[input.variables]`.
REQUIREMENTS AND LIMITATIONS
- Version: 4.9.0
- input_variables (required): Target-level setting for the metafield used to populate that target’s query variables; required when the query declares variables.
- input_variables.namespace (required): Metafield namespace.
- input_variables.key (required): Metafield key.
- [extensions.input.variables]: Extension-level variable placement; cannot be combined with target-level `input_variables` in the same function. For older configuration files without `[[extensions]]`, the section is `[input.variables]`.
- Prerequisite: Shopify CLI 4.9.0 or higher.
- Prerequisite: The referenced metafield must be JSON type; set it on the function owner.
- Target-level and extension-level variable placements cannot be mixed.
FIRST-PARTY EVIDENCE
- https://github.com/Shopify/cli/releases/tag/4.9.0
- https://github.com/Shopify/cli/pull/8471
- https://shopify.dev/docs/apps/build/functions/input-queries/use-variables-input-queries
Check the installed version and the source before using it. Entry JSON