Using templates

Templates are ready-made functions you can start from instead of writing code from scratch. This page covers browsing templates, using one, and saving or publishing your own.

On the Functions page, click Browse templates. The gallery is a card grid, not a table, and merges three sources into one place:

  • Curated templates - built and maintained by us, shipped with the app.
  • Your templates - ones you saved from your own functions.
  • Community templates - templates other stores chose to publish.

What the curated templates cover

The built-in set gives you a working example for each common job:

  • Tag a customer - add tags to a customer, for example mark them VIP.
  • Hide out-of-stock products - set a product to draft when its inventory hits zero.
  • Tag high-value orders - tag an order when its total crosses a threshold.
  • Create a discount code - create a percentage discount code.
  • Forward input to a webhook - POST the Flow input to an external URL, no permissions needed.
  • Echo input - a minimal starter that logs and returns what it receives.

Permission gating

Each card shows whether it is ready for your store:

  • Ready - you already have the permissions it needs (or it needs none).
  • Needs permissions - it uses store data you have not granted yet. The card lets you grant the missing permission inline, right there in the gallery.

This means you can see before using a template exactly what access it requires. See Permissions and store data access for how grants work.

Using a template

Click Use on a card. This creates a real function in your store immediately, with a unique name, and drops you straight into its editor. From there you can test it, edit it, and select it in a Flow action just like any function you wrote yourself.

For templates that act on a specific resource, the new function comes pre-filled with a sample id from your store on the Variables tab, so your first test run works out of the box.

You can also Preview a template's code before using it.

Saving your own template

In the function editor, open Save as template (a secondary action on a saved function). You choose:

  • Name and description.
  • Category - Customers, Products, Orders, Discounts, or Utilities.
  • Required permissions - the scopes the template needs, so the gallery can gate it for other stores.
  • Visibility - Private (only your store) or Public (shared with every store using the app).

Saving as a template copies the function's code, not your data. Secrets are never included. See Creating and using secrets.

Publishing to the community

Setting a template to Public makes it, including its full source code, visible to every store using Workflow Functions. Only publish code you are comfortable sharing:

  • Never publish a template that contains credentials, tokens, or private business logic.
  • Read a secret with secrets.NAME instead of hard-coding it, so the value stays in your store when the code is shared.

You can unpublish or delete your own templates at any time.

Next steps