Convert a Ruby Script to a Shopify Function — without rewriting it from scratch.
A Shopify Script and a Shopify Function solve the same problem in different languages and runtimes — Ruby running inside checkout versus WebAssembly running as a Function extension. Most Script logic maps onto a small, known set of Function patterns. Here's the mapping, what genuinely doesn't carry over, and three ways to actually do the conversion.
How common Script patterns map to Functions
Shopify Functions don't run Ruby, and they don't run your old Script file directly — but the logic inside most Scripts falls into a handful of well-understood patterns that a Discount, Payment Customization, or Delivery Customization Function can reproduce.
| Old Script pattern | Shopify Function equivalent |
|---|---|
| Tiered % or $ off by quantity | Discount Function — tiered quantity template |
| Wholesale / VIP pricing by customer tag | Discount Function — customer-tag pricing template |
| Buy X get Y free (BOGO) | Discount Function — BOGO template (cheapest-matching-line approximation) |
| % off once cart total passes $X | Discount Function — spend-threshold template |
| Discount only one eligible line, not all matches | Discount Function that finds eligible lines, picks one, and targets only that line — see our one-item discount guide |
| Hide/rename a payment method (e.g. Cash on Delivery over $X) | Payment Customization Function |
| Hide/rename a shipping rate | Delivery Customization Function |
| Free shipping once cart total passes $X | Delivery Customization / shipping-discount Function |
All eight of these are common enough that they don't require custom Function code — they're the exact templates Scriptly and other Functions apps ship as no-code rules.
What honestly doesn't carry over
A faithful migration means being upfront about the gap, not papering over it. Three things commonly show up in old Scripts that a Function genuinely can't do the same way:
Real limits, not edge cases
- Order history / past-purchase lookups. A Script could sometimes reference a customer's order history to decide on a discount. Functions run in a sandboxed environment scoped to the current cart and customer — they don't have access to a shopper's past orders.
- External API calls. If a Script called out to a third-party service — a loyalty platform, a custom pricing engine — a Function can't do that. Functions execute as compiled WebAssembly with no network access, by design, for checkout performance and security.
- Arbitrary or dynamic tag logic. A Script could sometimes check any tag a shopper happened to have. Functions can only check customer tags you configure ahead of time as a fixed list — not a tag typed in freely or generated dynamically at checkout.
If your old Script depended on any of these, the honest path is a custom Function build designed around the specific constraint, not a template — see the last path below.
Three ways to actually do the conversion
-
Hire a developer to hand-translate it
A developer reads your Ruby, rewrites the logic in JavaScript or Rust, and deploys it as a custom Function extension. This is the only path for logic that genuinely doesn't fit a template — order history, external calls, deeply nested conditions — but expect days, not hours, and Plus-level budget in practice.
-
Use a no-code rule builder and recreate it yourself
Read your own Script, identify which pattern from the table above it matches, and fill in a template's form fields by hand — a threshold, a percentage, a product list. No AI involved, just you matching the logic manually. Works well for a Script you already understand.
-
Paste it into an AI importer and get editable rules back
Scriptly's AI Script importer reads your pasted Ruby, identifies the condition and discount logic, and maps it to the closest rule template with a confidence score and the exact source lines it matched — you review and approve before anything goes live. The importer is available on Scriptly's Pro plan ($59/mo), which is less than what some competing apps charge for AI-assisted conversion alone. It never executes your Ruby — Shopify stopped running Scripts entirely on June 30, 2026, and importing doesn't bring that execution back.
Frequently asked questions
Can I run my old Ruby Script directly as a Shopify Function?
No. Shopify Functions run as compiled WebAssembly, not Ruby, and Shopify stopped executing Scripts entirely on June 30, 2026. Converting means mapping the Script's logic — the condition and the discount or customization it applied — onto a Function template, not running the original code.
Does an AI importer actually execute my Ruby code?
No — a Ruby-to-Function importer only reads the code as text to identify its structure. It never executes it, and nothing about the import process brings Script execution back.
What if my Script doesn't match any of the common patterns?
If it relied on order history, an external API call, or arbitrary tag logic, it won't map onto a no-code template — that's a genuine gap, not a tooling limitation, and a custom Function build is the honest path.
Do I need my original Ruby file to convert a Script?
No. If you don't have the original code, you can still rebuild the same logic by picking the matching template from the mapping table above and filling in the fields yourself — the AI importer is a shortcut for merchants who still have the file, not a requirement.
How much does converting a Script to a Function cost?
It depends on the path: a custom developer build is a day rate or project fee; a no-code rule builder can be free to start (Scriptly's free plan covers one active rule); an AI importer that reads old Ruby for you is typically a paid-tier feature, for example $59/mo on Scriptly's Pro plan.
Paste your Ruby, see the mapped rule.
Try the AI Script importer on Scriptly's Pro plan, or start free with one active rule and the full simulator, no credit card required.