---
title: "What Are Shopify Functions?"
url: https://www.uncap.com/glossary/shopify-functions
author: "Denis Dyli"
published: 2026-10-11
updated: 2026-10-11
summary: "Shopify Functions let developers customize Shopify's backend logic, such as discounts, delivery and payment options, order routing and checkout validation. A function ships inside an app, reads store data through a GraphQL input query, runs as a WebAssembly module, and returns operations for Shopify to carry out. They replace Shopify Scripts, deprecated on June 30, 2026."
---

# What Are Shopify Functions?

> Shopify Functions let developers customize Shopify's backend logic, such as discounts, delivery and payment options, order routing and checkout validation. A function ships inside an app, reads store data through a GraphQL input query, runs as a WebAssembly module, and returns operations for Shopify to carry out. They replace Shopify Scripts, deprecated on June 30, 2026.

**Shopify Functions**: Shopify Functions let developers customize Shopify's backend logic, such as discounts, delivery and payment options, order routing and checkout validation. A function ships inside an app, reads store data through a GraphQL input query, runs as a WebAssembly module, and returns operations for Shopify to carry out. They replace Shopify Scripts, deprecated on June 30, 2026.

## How it works

Every function has three parts:

- Input: a JSON object that is the result of a GraphQL input query the developer defines, such as cart line product data or metafields.
- Logic: code in any language that compiles to a WebAssembly module. Shopify provides templates for Rust and JavaScript and strongly recommends Rust, so a function doesn't fail with large carts.
- Output: a JSON document that describes the operations Shopify should carry out.

A developer creates and deploys an app that contains a function. The merchant installs the app and configures the function, and Shopify executes it as customers interact with the store. Functions are never invoked directly by URL. Shopify's Help Center says the WebAssembly platform executes them in under 5 milliseconds.

During checkout, functions run in a specific sequence, and each step builds on data from earlier steps:

**Where Shopify Functions run during checkout**

### 1. Cart lines, Cart Transform

Functions that change the pricing and presentation of cart lines run first.

### 2. Line discounts, Discount

Discount functions calculate cart line discounts.

### 3. Fulfillment groups, Fulfillment Constraints and Order Routing

Fulfillment Constraints and Order Routing functions run at the fulfillment groups step.

### 4. Delivery, Delivery methods, then delivery discounts

Pickup option generators and Delivery Customization run at the delivery methods step, then Discount functions run for delivery discounts.

### 5. Payment methods, Payment Customization

Payment Customization functions run at the payment methods step.

### 6. Verification, Cart and Checkout Validation

Validation runs last, so it can't run until discount calculations are complete.

## Function APIs with B2B uses

Shopify's Function API reference lists these use cases, several of them written for B2B buyers:

- Cart and Checkout Validation: B2B product minimums, maximums and multiples; B2B location order minimums, maximums or credit limits; and validating purchase order numbers for B2B customers. A store can activate up to 25 validation functions.
- Payment Customization: hide payment methods for carts above or below a given value, apply net payment terms based on buyer identity, and set payment terms with deposits for high-value orders. Adding a review requirement, so an order is submitted as a draft for review, is only available for B2B purchases on stores with the Plus plan.
- Discount: Shopify B2B lets merchants create custom discounts using Discount Functions for more granular conditions.

## Example

This is an illustrative example, not a Shopify template. A wholesaler wants a $500 order minimum for one B2B company location, one of the validation use cases Shopify lists. A buyer from that location builds a cart of 20 units at $21, so 20 x $21 = $420.

The validation function's input query reads the cart's subtotalAmount and the buyer's purchasingCompany. Because $420 is below $500, the function returns a validation error with a message the developer wrote, and checkout displays that message instead of letting the buyer proceed. The buyer adds 5 more units: 25 x $21 = $525, the function returns no error, and the buyer can continue.

## On Shopify

Stores on any plan can use public apps from the Shopify App Store that contain functions. Only stores on a Shopify Plus plan can use custom apps that contain Shopify Function APIs, and some Function capabilities are Plus only.

As of June 30, 2026, Shopify Scripts is deprecated, and any Scripts still published were deactivated. Shopify's Scripts customizations report in the admin lists what was active and links to Functions documentation or apps for recreating each customization, either by installing an app built on Shopify Functions or by building a custom solution.

## How Uncap helps

Uncap's [Shopify B2B](/solutions/shopify-b2b) builds treat checkout as a growth lever: checkout customized per segment and per B2B buyer, so the trade account and the first-time buyer each see a flow built for how they purchase.

## Related terms

- Shopify B2B
- Shopify Plus
- Payment terms
- MOQ (minimum order quantity)
- Order management system
- Webhook

## Sources

- Shopify Dev Docs: About Shopify Functions
- Shopify Dev Docs: Cart and Checkout Validation Function API
- Shopify Help Center: Transitioning from Shopify Scripts to Shopify Functions

## Frequently asked questions

### Can we do coding in Shopify?

Yes. Shopify Functions are one way: developers write code in a language that compiles to WebAssembly, such as Rust or JavaScript, and ship it inside an app to change Shopify's backend logic.

### How do I move from Shopify Scripts to Shopify Functions?

Open the Shopify Scripts customizations report from Apps, then Script Editor, in your admin. Review which customizations you still need, then recreate them by installing an app built on Shopify Functions or building your own.

### What are examples of Shopify Functions?

Shopify's tutorials include a new discount type, hiding a payment option at checkout, renaming a delivery option, blocking checkout when cart line quantities exceed a limit, and grouping products into a bundle sold as a single unit.
