Shopify Scripts shut down on June 30, 2026. Shopify's Script Editor help page says Shopify Scripts and the Script Editor app were retired on that date and that scripts no longer run on any store. Any discount, shipping or payment rule you kept in a Script stopped applying the same day, without an error message.
The replacement is Shopify Functions. This guide maps each Script type to its Function API, shows one short worked example for each, and walks the rebuild in order. If you only need to get discounts working again, Shopify Scripts are gone: how to replace your discount Scripts is the faster read.
The short version
- What ended: Shopify Scripts (Ruby, written in the Script Editor app, Shopify Plus only).
- When: June 30, 2026. Scripts no longer run.
- The replacement: Shopify Functions, small programs that ship inside an app and run on Shopify's servers during checkout.
- What to do: work out which Scripts you ran, map each to the matching Function API, rebuild and test, then turn the Function on in the admin.
Was my store affected?
Scripts were a Shopify Plus feature. If your store was never on Plus, you never had Scripts and nothing here broke for you.
If you were on Plus, three kinds of checkout behaviour were Script territory. If any of these quietly changed around June 30, 2026, a Script was probably behind it:
- Discounts that stopped applying: a spend threshold, a returning-customer reward, or a free gift that no longer comes off at checkout, with no matching automatic discount in the admin.
- Shipping rates that came back: an express option you used to hide for heavy carts, or a rate whose custom name reverted.
- Payment methods that came back: cash on delivery showing on large orders again, or wallets back in their default order.
If an agency or a past developer set up your checkout, ask them directly which Scripts you ran and what each one did. A list with the inputs each Script read (cart total, customer tags, order count, line item properties) is all you need to plan the rebuild.
Why Functions, and what they need
Scripts were tied to the old checkout. Functions are the native way to customize the current one. They run inside Shopify's checkout, they declare exactly what data they read, and they ship as app extensions built with the Shopify CLI rather than as code pasted into the admin.
That last point decides the plan question. Shopify's Functions documentation says stores on any plan can use public apps from the Shopify App Store that contain Functions, while only stores on Shopify Plus can use custom apps that contain Function APIs. Some individual capabilities are Plus-only too, and the Function API reference flags them per API. Scripts were Plus-only, so a store rebuilding its own Scripts can take the custom-app route. A store that has since left Plus needs an App Store app that does the same job.
Every Function has the same shape: a GraphQL input query that requests only the fields the logic needs, and a run function that reads that input and returns a list of operations. Nothing outside the input query is visible to the Function. For the head-to-head on the two models, see Shopify Scripts vs Shopify Functions.
Discount Scripts: Discount Functions
Line item Scripts that changed prices, applied automatic discounts, rewarded returning customers or freed a gift move to the Discount Function API. One API now covers product, order and shipping discounts. Cart-level discounts use the cart.lines.discounts.generate.run target, and shipping discounts use cart.delivery-options.discounts.generate.run.
A Script like this one:
# Old line item Script
if Input.cart.subtotal_price >= Money.new(cents: 10000)
Input.cart.line_items.each do |item|
item.change_line_price(item.line_price * 0.9, message: "10% off orders over $100")
end
end
becomes an order discount. The input query asks for the cart subtotal and the discount classes the merchant enabled:
query CartInput {
cart {
cost {
subtotalAmount {
amount
}
}
}
discount {
discountClasses
}
}
and the run function returns an orderDiscountsAdd operation when the threshold is met:
export function cartLinesDiscountsGenerateRun(input) {
if (!input.discount.discountClasses.includes("ORDER")) {
return { operations: [] };
}
const subtotal = parseFloat(input.cart.cost.subtotalAmount.amount);
if (subtotal < 100) {
return { operations: [] };
}
return {
operations: [
{
orderDiscountsAdd: {
selectionStrategy: "FIRST",
candidates: [
{
targets: [{ orderSubtotal: { excludedCartLineIds: [] } }],
value: { percentage: { value: "10.0" } },
message: "10% off orders over $100",
},
],
},
},
],
};
}
The decision is identical to the Script. The difference is that the Function returns an operation instead of rewriting line prices in place. Free gifts need one extra step, because nothing in a Function adds the gift to the cart; gift with purchase on Shopify covers that pattern.
Payment Scripts: Payment Customization Functions
Payment Scripts that hid, renamed or reordered payment methods move to the Payment Customization Function API. Its target is cart.payment-methods.transform.run, and it returns paymentMethodHide, paymentMethodRename or paymentMethodMove operations.
A Script that hid cash on delivery on orders of $500 or more becomes:
query CartPaymentMethodsTransformRunInput {
cart {
cost {
totalAmount {
amount
}
}
}
paymentMethods {
id
name
}
}
export function cartPaymentMethodsTransformRun(input) {
const total = parseFloat(input.cart.cost.totalAmount.amount);
if (total < 500) {
return { operations: [] };
}
const operations = input.paymentMethods
.filter((method) => method.name.toLowerCase().includes("cash on delivery"))
.map((method) => ({ paymentMethodHide: { paymentMethodId: method.id } }));
return { operations };
}
Payment method names vary by region and gateway, so check the exact name your checkout shows before you match on it. In production, keep the threshold and method names in the customization's metafield configuration rather than hard-coding them, which is how Shopify's own examples do it.
Shipping Scripts: Delivery Customization Functions
Shipping Scripts that hid, renamed or reordered rates move to the Delivery Customization Function API. Its target is cart.delivery-options.transform.run, and it returns deliveryOptionHide, deliveryOptionRename or deliveryOptionMove operations against the options the customer already qualifies for.
A Script that hid express shipping for one destination country becomes:
query CartDeliveryOptionsTransformRunInput {
cart {
deliveryGroups {
deliveryAddress {
countryCode
}
deliveryOptions {
handle
title
}
}
}
}
export function cartDeliveryOptionsTransformRun(input) {
const operations = [];
for (const group of input.cart.deliveryGroups) {
if (group.deliveryAddress?.countryCode !== "CA") continue;
for (const option of group.deliveryOptions) {
if (option.title?.toLowerCase().includes("express")) {
operations.push({ deliveryOptionHide: { deliveryOptionHandle: option.handle } });
}
}
}
return { operations };
}
Two limits are worth knowing from Shopify's API page. When you reorder options, the cheapest option is still the one selected first. And a rename keeps the carrier name in front of your new title.
If your Script built rates from scratch rather than filtering existing ones, there is no direct Function equivalent. Shopify's delivery option generator APIs cover local pickup and pickup points only, so custom calculated rates come from your shipping settings or a shipping rates app.
How to migrate, step by step
- List what each Script did. Note the inputs it read and the output it produced.
- Match each to a Function API. Use the three sections above. One Script usually becomes one Function.
- Create or reuse an app. Functions ship as app extensions. On Plus that can be a custom app for your store; on other plans it has to be a public App Store app.
- Generate the Function with the Shopify CLI (
shopify app generate extension), choosing the discount, payment customization or delivery customization template. - Write the input query and the run function. Request only the fields you need; anything missing from the query is invisible to the Function.
- Test in a development store against the same carts, customers and addresses your Script handled.
- Turn it on in the admin. A discount Function does nothing until an automatic discount or a discount code points at it. Payment and delivery Functions need their matching customization in checkout settings.
- Watch the first week of orders to confirm discounts, rates and payment methods behave as they did before.
Common gotchas
- The extension alone is inert. Every Function needs its admin hookup from step 7.
- Never hide everything. A customer left with no payment method or no shipping rate cannot check out, the same trap Scripts had.
- Test the edge cases. Empty carts, mixed carts, logged-out customers and different destinations all behave differently. Re-run the cases your Script covered.
- Free gifts are two jobs. The Function makes the gift free; something else has to put it in the cart.
If you want the rebuild done for you, Caffeine and Commerce migrates Shopify Scripts to Functions. Send us the list of Scripts you ran and we will map and rebuild each one.

Comments
Every comment here comes from a verified email. Write yours, confirm from your inbox, and it's live.
Loading comments…