Commerce Architecture
Shopify Functions
Definition
Shopify's platform for customizing backend commerce logic, such as discounts, cart and checkout validation, delivery and payment customization, cart transforms, and order routing. Functions are compiled to WebAssembly and run inside Shopify's infrastructure. They replaced Shopify Scripts, which stopped executing on June 30, 2026.
By Herzel MishelFounder, AgentisLast reviewed
Shopify Functions let developers inject custom logic into specific points of Shopify's backend, most visibly checkout. Each Function targets a Function API: Discount Functions (create or adjust discounts based on cart state), Cart and Checkout Validation (return errors that keep a buyer from completing checkout), Cart Transform (bundle, expand, or modify line items), Payment Customization (hide, reorder, or rename payment methods), Delivery Customization (hide, reorder, or rename shipping options), and order routing and fulfillment constraints. A Function receives an input defined by a GraphQL query, runs, and returns a set of operations for Shopify to apply. Functions are compiled to WebAssembly and executed by Shopify, not on the merchant's own servers. That gives predictable performance and a strong sandbox, at the cost of strict resource limits documented by Shopify and, for most Function APIs, no external calls during execution. In practice, any data a Function needs beyond the cart, such as configuration, thresholds, or cost figures, is staged ahead of time, typically in metafields, and kept current by a separate process. Functions are the replacement for Shopify Scripts, the Ruby-based customization layer for Shopify Plus. Shopify froze Script editing on April 15, 2026 and stopped executing Scripts on June 30, 2026, so logic that used to live in Scripts now runs as Functions, as native discount settings, or as an app built on Functions. Writing Functions directly requires a developer familiar with Rust or JavaScript, the WebAssembly toolchain, and Shopify's schemas; many merchants use apps that ship pre-built Functions instead. Functions are well suited to rules that can be decided from the cart: discount eligibility and combinations, quantity limits, address restrictions, B2B minimums. They are less suited to decisions that need live data from other systems, such as an order's true margin after current ERP cost, freight, and FX, because that data has to be staged and can drift. Agentis does not use Shopify Functions and does not run in checkout. It reads each order after it is placed, computes true net margin within 60 seconds from live store data, NetSuite COGS, freight, fees, and FX, and flags the order or holds it before fulfillment under merchant-approved rules. Functions decide what a buyer can submit; Agentis decides whether a submitted order should ship. The two are complementary.
Sources
Related Terms
Commerce Architecture
WASM Checkout (WebAssembly at Checkout)
The use of WebAssembly modules to run merchant-defined logic inside checkout. Shopify Functions, the replacement for Ruby-based Shopify Scripts, is the best-known implementation: logic is compiled to WebAssembly and executed in a sandbox within Shopify's checkout.
Commerce Architecture
Shopify Scripts (Deprecated)
Shopify's legacy Ruby-based checkout customization platform for Shopify Plus, used for custom discount, shipping, and payment logic. Shopify froze Script editing on April 15, 2026 and stopped executing Scripts on June 30, 2026; Shopify Functions is the replacement.
Profit Governance
Checkout Governance
The set of rules applied inside checkout that decide which discount combinations, shipping options, payment methods, and order configurations a buyer can complete. It acts before the order is placed, which makes it distinct from post-order margin controls that act before fulfillment.
Profit Governance
Policy Engine
The configurable rules layer of a profit firewall, where finance teams declaratively define margin floors, discount limits, MAP rules, and other enforcement criteria.
More in Commerce Architecture
See how Agentis compares to other ecommerce profit tools → View all comparisons