How can we help?
Documentation for Workflow Functions: run your own JavaScript or TypeScript in Shopify Flow. Setup, templates, secrets, scheduling, API and troubleshooting.
Popular:Introduction to Workflow FunctionsHow to create a functionUsing templatesSet up the Run Function action in Shopify Flow
Getting started
- Introduction to Workflow FunctionsRun your own JavaScript or TypeScript for your Shopify store - from Shopify Flow, from your ERP over the API, or on a schedule.
- How to create a functionCreate, write, test and save a function: the code editor, the test bench, settings, version history and the Run it tab.
- Using templates85 verified templates for Shopify Flow, ERP integrations and schedules: browse, preview, grant and use, and save your own.
- Set up the Run Function action in Shopify FlowConnect a function to a Shopify Flow workflow end to end: trigger, Run Function action, input, configuration page, a real run and its history.
- Passing variables into your functionHow to fill the input argument from the Flow action's Input (JSON) field, insert Flow variables with Liquid, and avoid an empty input.
- Example functionsCopy-paste example functions - HTTP requests, reading and writing Shopify store data, using input variables and secrets - from small to larger workflows.
- Connect your ERP or warehouse systemCall functions from your ERP with one HTTPS request: stock, prices, products, orders and shipments by SKU, with dry runs and batches.
Store data & secrets
- Permissions and store data accessManage per-resource read and write permissions for Shopify Flow functions, and see what revoking a scope does to running workflows.
- Creating and using secretsStore API keys encrypted and read them in function code as secrets.NAME. How to create, rotate, delete, and how masking protects run history.
- Storage for your functionsKeep data between runs with ctx.storage: get, set, delete and list, limits per plan, the Storage page and files.
Scheduling & usage
- Run a function on a scheduleRun a function automatically on a cron schedule - every few minutes, hourly, or daily - without a Shopify Flow trigger.
- Extra runs (pay as you go)Run functions past your plan's monthly allowance without upgrading - pay only for the runs you go over, with an optional monthly cap.
Developer
- Developer API and MCPAPI keys, the REST API and the MCP server: manage and run functions from your own code, your ERP or an AI agent.
- Sync your functions to GitHubKeep your function code in a GitHub repository. Every save commits, a push back updates the function, and the editor shows full version history.
- Generate functions with AIConnect your Anthropic, OpenAI, Google Gemini or OpenRouter key and describe a function in plain English - Write with AI drafts or changes the code for you.
- How to get an Anthropic (Claude) API keyCreate an Anthropic API key and connect it to Workflow Functions to generate functions with Claude.
- How to get an OpenAI API keyCreate an OpenAI API key and connect it to Workflow Functions to generate functions with GPT.
- How to get a Google Gemini API keyCreate a Google Gemini API key and connect it to Workflow Functions to write functions with AI.
- How to get an OpenRouter API keyCreate an OpenRouter API key and connect it to Workflow Functions to write functions with Claude, GPT, Gemini and more.
Reference
- Run history and troubleshootingRead the History page, understand run statuses and triggers, and fix the most common reasons a function fails in Shopify Flow.
- Frequently asked questionsCommon questions about running your own JavaScript from Shopify Flow: plans and quota, permissions, secrets, templates, the developer API, and data handling.
