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 your own.

On the Functions page, click Browse templates. The gallery is a card grid, not a table, with two kinds of templates:

  • Verified templates - built, maintained, and verified by Code Creation Labs and shipped with the app. These are the only public templates for now, and they carry a Verified badge.
  • Your templates - ones you saved from your own functions. These stay private to your store.

Sharing templates with other stores is coming soon. For now the only public templates are the verified ones from Code Creation Labs. Anything you save is private to your store.

What the verified 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 lists exactly which permission it needs.

So 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 - or Grant & use when the template needs a permission you have not granted yet. If a permission is missing, the app asks you to grant it first and only creates the function once it is granted, so the function can run right away. Nothing is created if you decline the grant.

Using a template creates a real function in your store 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.

Your templates are private to your store. Public sharing is coming soon; until then, saving a template keeps it available only to you.

Saving as a template copies the function's code, not your data - secrets are never included. Remember that function code is readable by anyone with access to the app, so keep credentials in secrets rather than in code. See Creating and using secrets.

Next steps