Function configuration
When you create a function, the shopify.extension.toml
file is automatically generated in your function extension directory. This guide describes the properties available in the shopify.extension.toml
file.
Anatomy of a function configuration file
Anchor link to section titled "Anatomy of a function configuration file"The shopify.extension.toml
file contains the extension's configuration, which includes the extension name, type, API version, UI paths, build configuration, and metafields for query variables.
Functions use common configuration properties for app extensions. Additionally, the following table describes the specific properties for Shopify Functions extensions available in shopify.extension.toml
:
Property | Description |
---|---|
[[extensions.targeting]] Required |
The name of the array that contains a target and its associated WebAssembly module export. Contains the following properties:
|
[extensions.build] Optional |
The settings related to the build and deployment of the function extension's WebAssembly module. Contains the following properties:
|
[extensions.ui] Optional |
The settings related to the merchant interface for your function. Contains the following properties:
|
[extensions.ui.paths] Optional |
The settings related to the App Bridge paths of the merchant interface for your function. Contains the following properties:
|
[extensions.input.variables] Optional |
The variables to use in your input query. Contains the following properties:
|
Properties for earlier versions
Anchor link to section titled "Properties for earlier versions"The following table describes the properties available in shopify.extension.toml
or shopify.function.extension.toml
file, for API versions 2023-07 and earlier:
Property | Required? | Description |
---|---|---|
name |
Yes | The name of the function. |
type |
Yes | The type of extension. |
api_version |
Yes | The version of the Function API. |
ui.enable_create |
No | Refer to configuring creation workflows for function owners. |
ui.paths.create |
No | Refer to create your function merchant interface. |
ui.paths.details |
No | Refer to create your function merchant interface. |
build.command |
Yes | The command to build the function which is invoked by the Shopify CLI build command. |
build.path |
No | The relative path to the function's WebAssembly module. For example, build/my-module.wasm . Defaults to dist/index.wasm . |
build.watch |
No | The relative paths that Shopify CLI should watch when the dev command is invoked. Changes to matched files trigger a build of the function and update it in your application drafts. This setting accepts a single file path or glob pattern, or an array of file paths and glob patterns.For JavaScript and TypeScript functions, this setting defaults to ['src/**/*.js', 'src/**/*.ts'] .Input queries are automatically included in watch paths and don't need to be configured in build.watch . |
input.variables |
No | Refer to use variables in input queries. |
- Learn how to replace hard-coded variables in your function with metafield values.
- Learn how to use variables in input queries with Shopify Functions.