eCommerce11 min read

Shopify Functions Replace Scripts June 2026: Migration

Shopify Scripts sunset June 2026, replaced by Shopify Functions. Migration guide with code examples, feature parity mapping, and timeline for merchants.

Digital Applied Team
March 13, 2026
11 min read
June 2026

Scripts Sunset Date

<5ms

Function Execution Time

5+

Function Extension Points

Wasm

Compiled Runtime Format

Key Takeaways

Shopify Scripts sunset is June 2026 — no extensions: Shopify has confirmed Scripts will stop working for all shops in June 2026. There is no opt-out or extension path. Every merchant running custom Scripts for discounts, line items, or shipping must complete migration to Shopify Functions before that date or lose that functionality entirely.
Functions run at the Shopify infrastructure level, not the storefront: Unlike Scripts, which ran in a sandboxed Ruby environment on Shopify's servers, Functions are compiled WebAssembly modules that execute inside Shopify's platform infrastructure. This means consistent sub-5ms execution, no cold starts, and access to the full extensibility API surface regardless of storefront stack.
The migration requires rebuilding logic, not just translating syntax: Scripts and Functions use fundamentally different programming models. Scripts were Ruby DSLs with implicit context. Functions are stateless WebAssembly modules with explicit inputs and outputs. Migrating means rethinking the logic, not just converting Ruby to another language.
Functions unlock capabilities Scripts never had: The migration is also an upgrade. Functions support cart transforms, checkout validation, delivery customizations, payment customizations, and order routing — none of which were possible with Scripts. Merchants who migrate proactively gain access to a richer extensibility surface.

Shopify merchants who built customized checkout experiences on Shopify Scripts are facing a hard deadline. June 2026 marks the end of Scripts — the Ruby-based customization layer that has powered thousands of custom discount, shipping, and payment flows since its launch. Shopify Functions is not just a replacement; it is a fundamentally different and more capable extensibility platform.

The challenge is that the migration is not straightforward. Scripts and Functions have different programming models, different runtimes, and different performance characteristics. Merchants who wait until May 2026 to start will find themselves scrambling. This guide walks through everything you need to understand the deadline, plan the migration, and build Functions that are more powerful than the Scripts they replace. For broader eCommerce strategy beyond the technical migration, our eCommerce solutions team helps merchants navigate platform transitions and optimize their technical stack.

Why Scripts Are Being Sunset

Shopify Scripts launched as a way to give merchants programmatic control over checkout customization without exposing the full complexity of the Shopify API. Scripts ran in a sandboxed Ruby environment with pre-defined input objects and expected specific output mutations. The model worked, but it came with inherent constraints that could not be resolved without a fundamental architecture change.

The core problem was the execution model. Scripts ran on Shopify servers in a managed Ruby environment that had to be provisioned, scaled, and maintained separately from the main Shopify infrastructure. This created inconsistent performance, cold start latency, and a ceiling on what Scripts could do. As Shopify moved toward a more composable commerce architecture, the Scripts model became an obstacle rather than an enabler.

Performance Ceiling

Ruby Scripts had unpredictable execution times with cold starts and variable latency that impacted checkout performance. Functions execute in under 5ms consistently with no cold start overhead.

Limited Scope

Scripts only covered discounts, shipping, and payments. Functions extend to cart transforms, checkout validation, order routing, fulfillment constraints, and more extension points being added over time.

Architecture Mismatch

Scripts relied on a separate Ruby runtime that could not be integrated into Shopify's evolving infrastructure. WebAssembly-based Functions run natively inside the Shopify platform at the infrastructure layer.

Shopify announced the Scripts sunset in 2023 with a multi-year runway specifically to give merchants and developers time to plan and execute migrations. The June 2026 date has not shifted, and Shopify has been clear that it will not be extended. The platform investment has moved entirely to Functions, and the Scripts infrastructure is being decommissioned.

What Are Shopify Functions

Shopify Functions are compiled WebAssembly modules that run inside Shopify's infrastructure at key points in the commerce lifecycle. Unlike Scripts, which were interpreted Ruby running in a separate environment, Functions are statically compiled artifacts that Shopify loads and executes as part of its own platform processing. The result is a dramatically different performance and capability profile.

You write Functions in Rust, JavaScript, or AssemblyScript. The Shopify CLI compiles your code to WebAssembly and deploys it as part of a Shopify app. Functions receive a structured JSON input describing the current cart or checkout state and return a structured JSON output describing the transformations to apply. The stateless input/output model is simpler to reason about and test than the mutable context model of Scripts.

Discount Functions

Replace Discount Scripts. Support percentage discounts, fixed amount discounts, buy-X-get-Y logic, and complex tiered pricing. Run on cart line items, order subtotals, or shipping rates.

Delivery Customization

Replace Shipping Scripts. Sort, rename, hide, or reorder delivery options based on cart contents, customer tags, delivery address, or any other cart input property.

Payment Customization

Replace Payment Scripts. Hide, rename, or reorder payment methods based on cart total, customer country, product types, or other cart attributes at checkout.

Cart Transform

New capability with no Scripts equivalent. Merge cart lines, expand bundles into component products, or transform cart line item properties before checkout begins.

Functions are deployed as part of a Shopify app, which can be a custom private app built for a single store or a public app distributed through the Shopify App Store. For most merchants migrating from Scripts, the app will be a private app — the equivalent of what Scripts were. The app container gives Functions access to app-level configuration, metafields, and the Shopify Admin API for managing function behavior without code changes.

Migration Timeline and June 2026 Deadline

The June 2026 sunset date is firm. Shopify has communicated the timeline repeatedly across developer documentation, partner emails, and the Shopify changelog. Here is the realistic planning timeline for merchants who have not yet started.

Merchants with multiple complex Scripts or those running Scripts that have accumulated years of edge-case logic should start immediately. The two-week parallel testing window in late May is non-negotiable — it is the only way to catch behavioral differences before the sunset forces the issue. Shopify Plus merchants with high-volume checkout flows should consider starting the audit now regardless of apparent simplicity.

Feature Parity Mapping: Scripts to Functions

Understanding which Script capability maps to which Function type is the starting point for every migration. The mapping is not one-to-one in implementation, but the business logic is transferable across all three core Script categories.

Script Type to Function Type Mapping

Discount Scripts

Maps to: Discount Functions (product discounts, order discounts)

Percentage off, fixed amount off, buy X get Y, tiered pricing, customer tag-based discounts, volume discounts, subscription discounts.

Shipping Scripts

Maps to: Delivery Customization Functions

Hide shipping rates, rename rates, reorder rates, apply conditional logic based on cart weight, total, or customer location. Free shipping thresholds.

Payment Scripts

Maps to: Payment Customization Functions

Hide payment methods, rename payment methods, reorder payment options, conditional logic based on cart total or customer country.

The key conceptual difference to internalize: Scripts mutated a shared mutable context object. Functions receive an immutable input and return explicit output operations. A Discount Function does not say “set this line item discount to 10%” by modifying an object — it returns an operation array that tells Shopify to apply a 10% percentage discount targeting a specific line item ID. The declarative output model is more predictable and testable.

For merchants also exploring broader platform capabilities alongside this migration, our guide on Shopify agentic storefronts and AI-visible products covers how the same platform evolution driving the Functions migration also enables AI-powered shopping experiences.

Migration Steps and Code Examples

The migration has four concrete phases: setting up the development environment, creating the Function scaffold, implementing the business logic, and configuring the Function in Shopify admin. Each phase maps to specific Shopify CLI commands and Function API concepts.

Setting Up the Functions Environment

Install Shopify CLI

npm install -g @shopify/cli

Create a new app (or use existing)

shopify app init my-functions-app

Generate a discount function scaffold

shopify app generate extension --type discount

Generate a delivery customization scaffold

shopify app generate extension --type delivery_customization

The generated scaffold includes a src/index.js (or src/main.rs for Rust) file with the Function entry point, a shopify.function.extension.toml configuration file, and a src/run.graphql file that defines the input query — what data from the cart Shopify should pass into your Function.

Example: 10% Discount for Tagged Customers (JavaScript)

src/index.js — Function entry point

export function run(input) { const customerTags = input.cart.buyerIdentity ?.customer?.tags ?? []; if (!customerTags.includes("wholesale")) { return { discounts: [], discountApplicationStrategy: "FIRST" }; } return { discounts: [{ targets: [{ orderSubtotal: { excludedVariantIds: [] } }], value: { percentage: { value: "10.0" } }, }], discountApplicationStrategy: "FIRST", }; }

Notice the structure: the Function receives a typed input object derived from your GraphQL input query, and returns an explicit operation array. There is no mutation, no side effects, and no implicit state. The discountApplicationStrategy field controls whether Shopify applies the first matching discount or all matching discounts when multiple discount Functions are active simultaneously.

Testing and Deployment for Functions

Functions have a significantly better testing story than Scripts. Because Functions are pure input/output transformations with no side effects, they can be unit-tested offline with mock JSON payloads. The Shopify CLI provides a built-in test runner that simulates the Function execution environment locally.

Testing and Deployment Commands

Run Function with local mock input

shopify app function run --input ./tests/mock-cart.json

Start local dev server (connect to development store)

shopify app dev --store your-dev-store.myshopify.com

Deploy to production app

shopify app deploy

Build Function Wasm artifact only (for CI)

shopify app build

The test JSON file mirrors the exact structure of your run.graphql input query result. Create a test file for each distinct logic branch in your Function: the base case with no discount applied, the case where the customer is tagged, the case where the cart total is below a threshold, and any edge cases your Script handled. This test coverage is your insurance policy before the June deadline.

Performance Capabilities and Limits

Functions introduce a radically improved performance profile compared to Scripts. The WebAssembly execution model eliminates cold starts entirely — the compiled Wasm artifact is cached at the infrastructure level and runs in the same process as Shopify checkout. Execution time consistently measures under 5 milliseconds for typical Functions, compared to the variable and sometimes multi-second response times observed with Scripts under load.

Performance Guarantees
  • Sub-5ms execution for typical Functions
  • No cold starts — Wasm is pre-warmed at infrastructure level
  • Consistent latency regardless of shop traffic volume
  • Linear scalability with Shopify's own checkout capacity
Platform Limits
  • Wasm linear memory capped at 10MB per Function
  • No network calls — Functions are fully offline at runtime
  • Input data limited to GraphQL query result scope
  • Execution time hard limit of 5ms (budget enforced)

The most important constraint to understand is that Functions cannot make network requests at runtime. All data needed for Function execution must come from the input query or from metafields stored on Shopify objects. If your Script made API calls to external services to determine discount eligibility or shipping options, you will need to rearchitect that pattern — either by syncing the external data to Shopify metafields or by using a different extension point that supports async operations.

Common Migration Pitfalls to Avoid

Based on merchant and developer reports from the migration wave that has been underway since late 2025, several patterns of failure emerge repeatedly. Knowing these in advance dramatically reduces the risk of discovering them under deadline pressure in May 2026.

The winter 2026 Shopify release also introduced improvements to the Functions development toolchain that are relevant to the migration. Our guide to the Shopify Winter 2026 Edition updates covers the Sidekick and SimGym changes that affect how merchants test and iterate on checkout customizations, including Functions.

Post-Migration Optimization Strategies

Completing the migration to parity with your Scripts is the minimum goal. But merchants who treat the migration as an opportunity to improve their checkout experience unlock significant upside. Functions offer capabilities that were simply not possible with Scripts, and the post-migration window is the right time to leverage them.

Bundle Expansion

Use Cart Transform Functions to build product bundle logic natively. Customers add a bundle SKU; the Function expands it into individual component products at checkout without any storefront code changes.

Checkout Validation

Add business rule validation at checkout — minimum order quantities, restricted products for certain customer groups, geographic shipping restrictions — using Checkout Validation Functions with meaningful error messages.

Dynamic Configuration

Store discount rules, shipping thresholds, and payment method logic in Shopify metafields instead of hardcoding them in Function code. Update business rules from the admin without redeploying the Function.

B2B and Wholesale

Combine Discount Functions with customer company metafields for sophisticated B2B pricing — customer-specific pricing tiers, volume breaks, and Net-30 payment option availability based on company account status.

The configuration-driven approach is particularly valuable for merchants who frequently update discount rules for promotions, seasonal offers, or partner agreements. Rather than deploying a new Function for every campaign, you define the rule structure in the Function code and store the specific values — discount percentage, eligible product tags, customer tier — in metafields that non-technical staff can update from the Shopify admin.

Conclusion

The June 2026 Shopify Scripts sunset is a hard deadline with no extension path. Merchants who have not started their migration should begin the audit and planning phase immediately. The migration requires rebuilding logic in a new programming model, not simply translating Ruby to another language, which means it takes real development time to do correctly.

The good news is that Shopify Functions are a genuine upgrade. Better performance, more extension points, testable input/output architecture, and configuration-driven business rules make the post-migration platform more capable than what Scripts ever offered. Merchants who complete this migration before the deadline and invest in proper testing will emerge with a checkout stack that is more reliable, more flexible, and better positioned for the platform direction Shopify is building toward.

Need Help With Your Shopify Migration?

The Scripts to Functions migration is a technical project with a firm deadline. Our eCommerce team helps merchants plan, build, test, and deploy Shopify Functions before June 2026.

Free consultation
Expert guidance
Tailored solutions

Related Articles

Continue exploring with these related guides