Shopify Flow - New Run code action

- Topic
- Automation
- Source
- Shopify Changelog
- Published
This summary was written by ShopDigest AI from Shopify Changelog’s report. Read the full story ↗
You can now use a new Run code action in Flow. In the action, you can write JavaScript code to return data into a workflow based on the inputs and…
Overview
Shopify Flow introduces a new Run code action that lets merchants write JavaScript to process data within workflows. This action expands automation capabilities by enabling custom logic, such as counting items, computing complex metafields, and transforming data. It is available for building workflows from scratch or using templates, with example code in a public GitHub repository.
Key Details
- Run code action accepts JavaScript and returns data into the workflow.
- Inputs are specified via a GraphQL query and available as JSON objects.
- Outputs can be scalars, lists, or objects, defined as a GraphQL type.
- Common use cases include counting list items, computing metafield values, and transforming dates or numbers.
- Documentation and community feedback channels are provided.
Frequently asked questions
What is the Run code action in Shopify Flow?
The Run code action is a new feature in Shopify Flow that allows you to write JavaScript code to process data within a workflow. It can return data based on inputs and your code, enabling custom logic that wasn't possible before.
What can I do with the Run code action in Flow?
Common use cases include counting items in a list, computing values for complex metafields like lists, and transforming data such as dates and numbers so they can be used in conditions. The code can leverage data from prior workflow steps.
How do I specify inputs and outputs for the Run code action?
Inputs are specified as a GraphQL query and are available as JSON objects to your code. Outputs are defined as a GraphQL type, and you can return simple scalars, lists, or objects.
Where can I find examples of code for the Run code action?
Example code snippets are available in a public GitHub repository. You can also build a workflow from scratch in Flow or use a template to get started.

