Why Shopify Functions Make Discount Apps Faster (And Why It Matters for Your Store)
Shopify Functions power DealCraft's discount engine — running custom logic at checkout with sub-50ms performance. Learn why this architecture matters for conversion rates, and how it compares to legacy checkout scripts.
Why Shopify Functions Make Discount Apps Faster (And Why It Matters for Your Store)
Every millisecond of checkout latency costs you money. Industry research has consistently shown that even a 100ms delay in page load time can reduce conversion by measurable margins. For Shopify stores, the checkout is where the money is made — and discount calculations that slow down checkout directly reduce your revenue.
Shopify Functions are the modern architecture for checkout customization. They replace the legacy Script API with a faster, more flexible, and more reliable system that runs on Shopify's edge infrastructure. DealCraft's discount engine is built entirely on Functions — and in this article, we'll explain why that matters for your store's performance and conversion rates.What Are Shopify Functions?
A Shopify Function is a small piece of compiled code that runs on Shopify's infrastructure during checkout. It receives input data (cart contents, customer information, product details) and returns instructions (apply this discount, add free shipping, etc.).
Think of it as a serverless function that Shopify executes at the right moment in the checkout flow. The key characteristics:
- Pure functions — They read data and return operations. They cannot modify the cart directly, which makes them predictable and safe.
- Sub-50ms execution — Shopify enforces strict performance limits. If your Function takes longer than 50ms, it's killed and the default behavior applies.
- WASM-powered — DealCraft compiles Rust to WebAssembly (WASM), which runs at near-native speed on Shopify's edge nodes.
- Edge-distributed — Functions run on Shopify's global edge network, not on a single server. This means low latency regardless of where your customer is.
The Old Way: Legacy Script API
Before Functions, customizing discounts at checkout required two things:
1. Shopify Plus — The Script API was only available to Shopify Plus merchants ($2,000+/month plans).
2. Ruby-based Scripts — Scripts ran on a shared Ruby runtime with cold start penalties, global state issues, and limited isolation between apps.
The performance was acceptable for its time, but as stores grew and discount logic became more complex, the limitations became clear:
- 200-500ms checkout impact — Scripts added significant latency, especially with multiple scripts running
- Plus-only — Regular Shopify plans ($29-$299/month) had no access to custom checkout logic
- No isolation — Scripts from different apps could conflict with each other
- Cold starts — Infrequently-used scripts suffered from cold start delays
Why This Matters for Your Store
1. Faster Checkout = Higher Conversion
The relationship between checkout speed and conversion rate is well-documented. Every additional second of checkout time increases cart abandonment.
With Functions, discount calculations happen in under 10ms — effectively invisible to the customer. The checkout feels instant because it is instant.
| Approach | Checkout Impact | Plan Requirement |
|----------|----------------|-----------------|
| Legacy Script API | 200-500ms | Shopify Plus only |
| Checkout UI Extension | 50-100ms, visual only | All plans |
| DealCraft Functions | <10ms, native cart integration | All plans |
2. Available to All Shopify Plans
You no longer need a $2,000/month Shopify Plus subscription to get custom discount logic. DealCraft works on Basic Shopify ($29/month), Shopify ($79/month), Advanced ($299/month), and Plus.
This means small and medium stores can now access the same discount capabilities that were previously exclusive to enterprise merchants.
3. No Conflicts Between Apps
Functions are sandboxed — each app's Function runs in isolation and cannot interfere with other apps. This eliminates the "discount wars" where two apps try to modify the same cart and produce unexpected results.
With DealCraft, your discounts work reliably alongside other checkout extensions. The priority and stacking controls in DealCraft let you define exactly how discounts interact with each other.
4. Predictable Performance Under Load
During Black Friday or flash sales, your store experiences traffic spikes that can stress server-side applications. Functions run on Shopify's infrastructure, not yours — so they scale automatically with Shopify's checkout capacity.
Your discount logic won't slow down when you need it most.
How DealCraft Uses Functions
DealCraft includes two Function engines, both compiled from Rust to WebAssembly:
discount-rs — Handles all discount types:- Percentage off and fixed amount discounts
- BOGO (Buy One Get One)
- Buy X Get Y (volume discounts)
- Tiered pricing (quantity-based)
- Customer-conditional and product-conditional discounts
- Country-specific thresholds (e.g., $75 in US, $100 in EU)
- Product-specific rules (e.g., free shipping on furniture)
- Combined with order value conditions
Each engine follows the same pattern:
1. Read configuration — Rule settings are stored in Shopify Metaobjects and loaded at the start of each Function execution
2. Calculate in milliseconds — The Rust engine processes cart data and determines applicable discounts
3. Return operations — The Function returns a list of discount operations to Shopify, which applies them to the cart
The entire process completes in under 10ms for typical carts with fewer than 50 line items.
Real-World Impact: What Merchants See
After switching from legacy discount apps to DealCraft's Function-based engine, merchants typically see:
- Faster checkout completion — Customers complete checkout more quickly because discount calculations don't add latency
- Fewer support tickets — "Checkout is slow" complaints disappear because the discount engine is no longer a bottleneck
- Higher conversion during sales — Flash sales and Black Friday promotions run smoothly without performance degradation
- More complex promotions — Merchants run multi-layered discount strategies (stacking, priority, conditions) that weren't possible with legacy scripts
The Technical Details (For Developers)
If you're a developer evaluating DealCraft's architecture:
- Language: Rust, compiled to WASM via javy
- Input: Cart data, product data, customer data, discount node configuration
- Output: Discount application operations (percentage, fixed amount, free shipping)
- Runtime: Shopify's Function runtime on edge nodes
- Configuration storage: Shopify Metaobjects (no external database needed)
- Execution model: Pure function — no side effects, no network calls, deterministic output
The Function source code is open and available in the DealCraft repository. You can audit exactly how discounts are calculated.
Getting Started
Install DealCraft from the Shopify App Store and your discounts are automatically powered by Functions. No configuration needed — the Function engine is active by default for every rule you create.
Want to see how different discount types affect your profit margins before setting them up? Try the free DealCraft Discount Calculator — compare BOGO, percentage off, fixed amount, and volume discounts side-by-side with your own product data.
Ready to find the optimal price point for your products? The Pricing Strategy Tool helps you simulate different price levels, compare psychological pricing suggestions, and see how discount depth affects your bottom line.
Shopify Functions are the future of checkout customization. DealCraft makes them accessible to every Shopify merchant, regardless of plan level. Install free and experience sub-10ms discount calculations at checkout.