Skip to content

Ecommerce engineering

Shopify Functions

Shopify Functions Development

Some checkout rules cannot be an app or a script — they have to run inside Shopify's own checkout. Functions are how. We build them, test the edge cases, and configure them through metafields so the merchant can change the numbers without a deploy.

A cart read line by line, and the operation each line returnsCOM · 05
Overview

Logic that runs where the decision is made

A Function is a small piece of logic you hand to Shopify, which Shopify executes at the moment it prices a cart, validates a checkout, or picks a delivery option. It runs on their infrastructure, inside the checkout, with no network call to you — which is exactly why it can do things an app cannot.

The interesting part is rarely the happy path. It is what the rule does to a gift card, to a cart of eleven when the pricing was written for one, to a product that should have been excluded, and to a discount that meets another discount. Those are the cases we write tests for, because they are the ones that reach a customer.

Runs inside checkout
No callback to your server, no latency budget, no outage of yours that can break a purchase. Shopify executes it.
Configurable without a deploy
Rates, thresholds and exclusions live in metafields, so changing a fee is an admin edit rather than a release.
Quantity-safe by construction
Per-unit versus per-line is the most common Function bug in production. We write the tests that catch it before a customer does.
What's included

What the engagement covers

  1. Discount Functions — order, product and shipping discounts
  2. Cart Transform — added fees, bundles and line-item changes
  3. Checkout validation — blocking a purchase that must not proceed
  4. Delivery and payment customization rules
  5. Metafield-driven configuration the merchant can edit
  6. Unit tests over the exclusion and quantity edge cases

Technologies

  • Shopify Functions
  • Cart Transform API
  • Shopify Plus
  • Rust
  • GraphQL
  • Metafields
Use cases

Where this helps most

  • A fee that applies to some items and not others

    An import fee, a handling charge or a surcharge that must skip gift cards, specific products or tagged collections, and must be right at any quantity.

  • A discount your promotions engine cannot express

    Tiered, conditional or combination logic that the native discount types do not cover.

  • A checkout that must refuse

    A cart that should not be allowed to complete — restricted items, incompatible combinations, a delivery region you cannot serve.

Process

How we deliver

  1. Write the rule down

    In prose first: what it applies to, what it excludes, what happens at quantity two, and what happens when it meets another discount. Ambiguity here becomes a bug later.

  2. Build the Function

    Implemented against the Function API for its target, with configuration read from metafields rather than compiled into the logic.

  3. Test the edges

    Gift cards, excluded tags, mixed carts, high quantities, and the interaction with existing discounts — each as a test rather than a manual check.

  4. Deploy and observe

    Released through your app, verified against real carts in a development store, then watched on the first live orders it touches.

FAQ

Shopify Functions Development

Do we need Shopify Plus?
For most Function targets, yes — Cart Transform and checkout validation in particular are Plus features. Some discount Functions are available more broadly. We check your plan against the specific target before scoping, rather than after.
Can the merchant change the rule afterwards?
The values, yes — that is what the metafield configuration is for, so a rate or a threshold is an admin edit. Changing the shape of the rule itself, like adding a new kind of exclusion, is a code change and a deploy.
How do Functions interact with our existing discounts?
That is one of the first things we pin down, because it is where the surprises live. Combination behaviour is explicit in Shopify's model, so we decide it deliberately and test the combinations rather than discovering them in production.
Rust or JavaScript?
Shopify's Function runtime targets WebAssembly and Rust is the best-supported path, which is what we usually reach for. The choice affects build tooling, not what the Function is allowed to do.
Let's build

Ready to start with shopify functions development?

Tell us about your store and your goals. We'll come back with a clear, honest plan and a transparent quote.