Shopify Functions Explained: Moving Beyond Shopify Scripts

Shopify Functions Explained: Moving Beyond Shopify Scripts

For years, Shopify Plus merchants used Shopify Scripts — small Ruby programs run in the Script Editor — to build custom discounts, hide shipping rates or reorder payment methods. Shopify is retiring Scripts in favour of Shopify Functions, and has published a sunset date in 2026. If your store still depends on Scripts, now is the time to plan the move.

What are Shopify Functions?

Functions are small pieces of backend logic that Shopify runs inside its own infrastructure at specific points of the commerce flow. They are written in JavaScript or Rust (or any language that compiles to WebAssembly), packaged inside an app, and configured by merchants in the Shopify admin.

Common uses include:

  • Discounts — tiered pricing, buy X get Y, bundle discounts and customer-tag pricing.
  • Delivery customisation — renaming, hiding or reordering shipping options.
  • Payment customisation — hiding cash on delivery for high-value orders or reordering payment methods by market.
  • Cart and checkout validation — enforcing quantity limits or blocking incompatible products.

How Functions differ from Scripts

  • Performance: Functions run as compiled WebAssembly with strict time limits, so they are fast and predictable even during flash sales.
  • Configuration: merchants can manage Function-based discounts in the normal Discounts screen instead of editing code.
  • Availability: many Function types can be used on any plan through public apps, while Scripts were limited to Shopify Plus.
  • Input is explicit: each Function declares a GraphQL input query, so it only receives the cart data it needs.

Building a Function

Functions live inside an app, even a private one built just for your store. The Shopify CLI scaffolds everything:

# create an app to hold your functions
shopify app init
cd my-store-functions

# add a function extension (choose a discount, delivery or payment template)
shopify app generate extension

# run against a development store, then release a new app version
shopify app dev
shopify app deploy

The generated extension contains an input query (.graphql), the function logic and a configuration file. You test locally with sample input, deploy a new app version, and then the merchant enables the discount or customisation in the admin.

Checkout extensibility goes hand in hand

Scripts are only part of the picture. Customisations made through checkout.liquid and the old Additional scripts box have also been replaced by checkout extensibility: checkout UI extensions for custom content and fields, the branding API for styling, and customer events with web pixels for tracking. Most migrations update all of these together.

A migration plan that works

  1. Audit every active Script and checkout customisation and write down the business rule each one implements.
  2. Check native features first. Shopify’s built-in discounts and Markets now cover many rules that once needed a Script.
  3. Check existing apps. Several well-supported apps implement common Functions with merchant-friendly settings.
  4. Build custom Functions only for rules that are genuinely unique to your business.
  5. Test side by side on a development store with real cart scenarios before switching off the Script.

If your store relies on Scripts or checkout customisations, our Shopify Plus team can audit them and plan a low-risk move to Functions.

Sources

Need a hand?

Stuck on a build?
Let's solve it together.

Our engineers fix, upgrade and scale Magento, WordPress and modern stacks every day.