Skip to main content
A function is two things: a record in a store version (name, trigger, type, priority, error behaviour, active flag) and the code deployed to it. Both are needed before it runs.

1. Create the record

Functions → Create Function: name, Active (leave it off until the code is deployed), On error (Skip or Throw), Priority, and the Version. You can drop the code zip here too; most people deploy from the CLI instead.
Create Function form
Then open the function and fill in Trigger Configuration: provider, URL, HTTP method, trigger type (Request or Response), optional conditions. Click Save. See Triggers.
Note the defaults differ: the Admin form starts with Skip and Active, the CLI with Throw and inactive.

2. Write and test the code

Put the code in functions/<name>/index.ts with a named handler export (Writing a function), add a function.json mirroring the trigger, and run it locally:
See function dev for the local pipeline and the curl calls to drive it.

3. Deploy the code

The CLI zips the project, uploads it, and follows the build. --name is the folder name under functions/. See deploy for what goes into the zip and .ollieignore.
The build installs your package.json dependencies, bundles everything into one file, and creates or updates the function’s runtime. The first deploy takes longer than the following ones.

4. Activate

Turn Active on in the function’s General Configuration (or ollieshop function update --function-id <id> --active true). The hub refreshes its list of active functions within 3 minutes; new code is used as soon as the build succeeds.

Checking it runs

  • The Builds tab lists every build with its status and log.
  • In the checkout, trigger the call the function watches and look for its effect. For a response function that adds extensions, read them with useCheckoutSession() in a component or in the browser’s network tab of the checkout’s own server action.
  • A function with Throw that fails makes the call return “An unexpected error occurred”. Switch it to Skip while debugging.

Updating and retiring

  • Redeploy with the same deploy command. Each build replaces the previous code.
  • The runtime settings (Node version, memory, time limit, runtime library) are set on the first deploy and not changed by later ones. When a function needs a capability shipped after it was first created, create a new function record and deploy there.
  • To stop a function, turn Active off. To remove it, Delete Function in the Danger Zone; this cannot be undone.