In ecommerce, every millisecond at checkout matters. That’s why we’re highlighting how Discount Kit, a leading Built for Shopify discount app, unlocked major performance and capability gains by migrating to both the new Discount API and the WebAssembly API for Shopify Functions. These migrations didn’t just speed up their app—they enabled new discounting features and more powerful promotions for merchants.
The evolution of Shopify Functions
Shopify Functions empower developers to extend and customize core Shopify workflows like discounts, shipping, and payments.
Historically, Discount Kit and other apps could only generate product, order, or shipping discounts as separate Functions—each tied to its own code and configuration. This limited what merchants could offer, and created unnecessary complexity.
The Functions tooling also processed all input data upfront, converting everything into usable structures before running any business logic. This approach wasted compute cycles on data that might never be used, adding performance overhead and increasing the risk of hitting compute limits.
Two major improvements have changed this landscape:
1. The new Discount API
The Discount API now allows apps to generate product, order, and shipping discounts—all powered by a single Discount Code. Merchants can combine multiple discount effects, reduce the number of Functions needed, and unlock more flexible promotions. In addition, Shopify now allows up to 25 Discount Functions to run at once, enabling even the most complex offers.
2. The WebAssembly API
The WebAssembly API introduces a lazy-loading approach;Functions execute immediately, and only build (deserialize) the data structures your code actually accesses. This shift brings three key benefits:
- Faster execution: No more upfront processing of unused input data.
- Smaller binaries: No need for bulky JSON parsing or data manipulation libraries.
- Fewer compute limit errors: Functions stay within Shopify’s instruction limits, reducing failures.
For developers, this means fewer resource constraints and more reliable execution. For buyers, it means a faster, more dependable checkout.
Discount Kit’s dual migration: More speed, more power
Sammy and the team at Discount Kit recognized the opportunity. They migrated their most complex discount Function to both the new Discount API and the WebAssembly API—tackling performance and unlocking new discounting capabilities at the same time.
With the Discount API, Discount Kit can now trigger multiple discount effects with a single code and support up to 25 Discount Functions running at once. With the WebAssembly API, their Functions run faster, use less compute, and are more reliable.
The results
Discount Kit’s migration delivered:
- Instruction counts dropped by 30%: Typical runs now use 430,000 instructions instead of 610,000 (75th percentile).
- Binary sizes shrank by 40%: Down from 249 KB to 156 KB.
- Near elimination of instruction count errors: Their most complex Function now runs reliably, even at scale.
- More powerful discounts: Merchants can combine multiple effects and run up to 25 Functions at once—enabling advanced promotions.
The WebAssembly API migration was straightforward and immediately solved our most pressing performance challenges. We’re now able to offer more powerful discounting options without worrying about hitting instruction limits.
—Sammy Isseyegh, creator of Discount Kit
Why this matters for merchants and buyers
These improvements have real impact:
- Higher conversion rates: Faster, error-free checkout reduces abandonment.
- Advanced discount logic: Merchants can implement sophisticated business rules without performance constraints.
- Better reliability: Functions complete successfully, even for complex discounts.
- Scalability: Leaner Functions handle larger carts and more data.
- Flexible promotions: Merchants can combine multiple discount effects and activate up to 25 Discount Functions at once.
How to get started
Ready to optimize your own Shopify Functions? Here’s how:
- Update your Function to version 1.1.0 or above of the Shopify Functions Rust library.
- Review the Discount API documentation and the WebAssembly API integration guide.
- Start with your most complex or resource-intensive Function for maximum impact.
- Test thoroughly as you migrate all of your Functions.
The future of Shopify Functions
Shopify’s ongoing investment in performance and developer experience is clear. As more partners like Discount Kit adopt these advancements, the entire ecosystem benefits.
The WebAssembly API and Discount API are available now—giving you the tools to build faster, more capable commerce experiences.
Are you ready to take your Shopify Functions to the next level? Dive into the documentation today and transform your app’s performance.