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.
Scripts Sunset Date
Function Execution Time
Function Extension Points
Compiled Runtime Format
Key Takeaways
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.
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.
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.
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.
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.
Replace Shipping Scripts. Sort, rename, hide, or reorder delivery options based on cart contents, customer tags, delivery address, or any other cart input property.
Replace Payment Scripts. Hide, rename, or reorder payment methods based on cart total, customer country, product types, or other cart attributes at checkout.
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.
March–April 2026 — Audit and plan: Inventory all Scripts running on your store, document what each does, and identify the equivalent Function type for each. Assess developer capacity and decide whether to migrate in-house or engage a Shopify development partner.
April–May 2026 — Build and test: Develop Function equivalents using the Shopify CLI, test against development stores, and run parallel testing with Scripts still active to verify parity. Address edge cases before the production deployment window.
Late May 2026 — Deploy to production: Deploy Functions to your live store with Scripts still running. Monitor for at least two weeks with both running to catch any discrepancies before Scripts are forcibly deactivated.
June 2026 — Scripts sunset: Scripts stop executing for all stores. Functions must be fully operational and verified. No rollback to Scripts is possible after this date.
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.
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.
Install Shopify CLI
npm install -g @shopify/cliCreate a new app (or use existing)
shopify app init my-functions-appGenerate a discount function scaffold
shopify app generate extension --type discountGenerate a delivery customization scaffold
shopify app generate extension --type delivery_customizationThe 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.
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.
Run Function with local mock input
shopify app function run --input ./tests/mock-cart.jsonStart local dev server (connect to development store)
shopify app dev --store your-dev-store.myshopify.comDeploy to production app
shopify app deployBuild Function Wasm artifact only (for CI)
shopify app buildThe 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.
Parallel running tip: After deploying your Function, keep your Script active for at least two weeks. Both can run simultaneously. Use this window to compare checkout behaviors across different cart configurations before manually deactivating the Script ahead of the June sunset.
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.
- 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
- 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.
Assuming the input has what you need: The Function only receives the data you explicitly request in your run.graphql query. If you need customer tags, product type, vendor, or metafields, you must add them to the query. Start by mapping every data point your Script accessed to a corresponding GraphQL field.
Undocumented Script behavior: Many Scripts have accumulated logic that developers no longer fully understand or that was added years ago for edge cases no one remembers. Treat the migration as a forced audit. Read every line of every Script and document what it does before writing a single line of Function code.
Not testing the empty cart and edge cases: Functions must handle every possible input gracefully, including empty carts, guest checkouts with no customer object, carts with products that have no metafields, and international carts with unusual currency or address formats. Scripts often crashed silently in these cases; Functions expose them as hard errors.
Ignoring the 5ms execution budget: Functions have a hard 5ms execution time limit. Complex JavaScript with large data structures, deep iteration, or regex processing can hit this ceiling. Test with realistic cart sizes — 50+ line items if your store supports bulk orders — before deploying to production.
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.
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.
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.
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.
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.
Related Articles
Continue exploring with these related guides