Running a Large Number of Offer Personalizations with Shopify Functions
Introduction
Intelligems uses the Shopify Discount Function API to power our Offers feature, ensuring seamless, native integration with your Shopify store. Discount Functions are Shopify's modern approach to customizing discounts and promotions. Unlike legacy discount code systems, Discount Functions run server-side and integrate directly into Shopify's checkout flow, providing:
Native checkout integration: Discounts appear automatically at checkout without requiring customers to enter codes
Real-time calculation: Offers are evaluated and applied instantly as customers shop
Stackability control: Precisely manage how offers combine with other discounts
Performance: Fast, reliable discount application with no impact on page speed
Security: Server-side validation prevents discount abuse or manipulation
When you create an Offer in Intelligems (quantity discounts, flat discounts, free gifts, free shipping discount), we automatically configure the appropriate Discount Function in your Shopify store. This means your offers work exactly like native Shopify discounts—they just have the added power of Intelligems' A/B testing and analytics behind them.
For merchants, this means a seamless experience: your offers appear naturally in the cart and checkout, your customers don't need to remember codes, and everything works with Shopify's native discount stacking rules.
Multiple Functions
Shopify Discount Functions have storage limits on how much configuration data they can hold. When your store has more than ~20 Offers (whether active or inactive), Intelligems automatically distributes them across multiple Discount Functions to ensure everything works properly.
This means that you'll have several Discount Functions operating independently. Each function will return its own result, and will apply stacking logic only to the Offers stored within that Discount Function. When the Discount Functions run on your store, Shopify will choose the single result with the maximum benefit, and apply that discount to the order.
Example:
Function A holds Offer 1 (10% discount) and Offer 2 (15% discount). Both are set to stack.
Function B holds Offer 3 (30% discount), also set to stack
If a user is eligible for all the above Offer Personalizations, Function A will return a stacked discount (10% + 15%) and Function B will return a single discount (30%)
Because the result from Function B has a greater benefit (30% > 10% + 15%) only the result from Function B will apply to the order.
How many functions can I use?
If you are using checkout.liquid you can only have 1 active discount function with an 'automatic' application method (this is the type of Discount Function our Offers use). Otherwise, Shopify allows for a maximum of 25.
However, this number isn't scoped to just the Intelligems app - every automatic discount, whether it's created by another app or Shopify, counts against this total.
If there are any Offer(s) that we couldn't find Discount Function space for, we'll highlight them in red. These Offers will not run on your store. To make room so they will run, you can remove any non-Intelligems automatic discounts, or archive Intelligems Offers that you are not currently using.
Last updated