# Shopify Functions development, for the rules your checkout runs on.

> For Shopify Plus brands, we write Functions for discount, delivery, payment and validation logic, including rules that used to live in Shopify Scripts. Each Function is typed, tested and shipped in an app you own. Work starts with a three-week Architecture Review that maps every rule before code is written.

Custom apps and integrations · Shopify Functions

- **Starts with:** A three-week Architecture Review
- **Typical build:** Phased, each Function priced before it starts
- **You own:** The Function code, its tests and documentation

## When does a store need Shopify Functions?
- Discount rules have outgrown what native discounts and public apps can combine.
- Logic still lives in Shopify Scripts and needs a supported replacement.
- Delivery or payment options must change by customer, cart or destination.
- Wholesale orders need minimum values or quantity limits enforced at checkout.
- Stacked apps compete for the same cart, and nobody owns the outcome.

## How does a Shopify Functions build run?
1. **List every rule** — Inventory discounts, Scripts, app logic and manual workarounds the store relies on.
2. **Choose the API** — Match each rule to a Function API, a native setting or an app.
3. **Write the Functions** — Typed code in Rust or JavaScript, tested against fixtures for each cart scenario.
4. **Test on a development store** — Run each Function with your products and edge-case carts before customers see it.
5. **Release and watch** — Ship as a versioned app release, with Function run logs checked after launch.

## Every rule in code your team can read
- An inventory of every discount, delivery and payment rule
- A map from each Script or app to its replacement
- Functions in Rust or JavaScript, in your repository
- Test fixtures for each cart scenario
- Settings your team can adjust without a code change
- A release and rollback plan
- Documentation of what each Function does and why

## What usually goes wrong
- **Porting Scripts line by line** — Functions work differently; restate the rule, then rebuild it.
- **Ignoring how discounts combine** — Set combination rules deliberately, or customers stack offers.
- **Testing with small carts only** — Functions have execution limits; test large carts too.
- **Hard-coding values the team will change** — Put thresholds in settings, not in a redeploy.

## Wholesale order rules, written as checkout Functions

For a clinical skincare brand we built four B2B storefronts, each with its own buyers, prices, terms and rules, enforced at checkout by Shopify Functions and run alongside eleven store-aligned custom apps the brand owns.

## Questions
### What can Shopify Functions customise?

Functions change backend logic that Shopify runs for you: discounts, cart and checkout validation, bundles through cart transforms, delivery and payment options, fulfilment constraints and order routing. They have no interface of their own. For fields and messages in checkout, we pair them with checkout UI extensions.

### What replaced Shopify Scripts?

Shopify Scripts are being retired in favour of Functions. Line item, shipping and payment Scripts each have Function APIs to move to, but the mapping is rarely direct. We restate each rule in plain language first, then rebuild it, so nothing depends on how the old Ruby code happened to behave.

### Which Shopify plan do custom Functions need?

Functions in a custom app, built for your business, need Shopify Plus. Public apps from the Shopify App Store can bring Functions to other plans. If a rule needs a custom Function and you are not on Plus, the Architecture Review sets out the options.

### Do we need a Function, an app, or both?

Both, in practice: a Function always ships inside an app. The Function is the rule. The app is how it is deployed, configured and versioned. Cart and checkout logic belongs in the Function; screens, data sync and admin tools belong in the app around it.

### How are Functions tested before they go live?

Each Function runs against fixtures: saved cart inputs paired with the output we expect. They run on every change. Then we check the Function on a development store with your products before release. After launch, run logs show the input and output of each run.

[Book an Architecture Review](https://www.studioantipodes.com/start-a-project)