Hi Shopify community,
I’m building a Shopify app that implements campaign-based tiered pricing discounts for product variants using Shopify Functions. The rules are stored in variant metafields as JSON, including time-based conditions for start/end dates, quantity thresholds, discount types (e.g., percentage), values, and customer segments.
Quick Setup Recap:
-
Metafield: Namespace
test, Keyrules, Ownervariant, JSON type. -
Example JSON:
{ "cn": "Special Offer", "sd": "2025-09-22T10:14:00Z", "ed": "", "r": [ { "q": "4", "t": "p", "v": "20", "c": "all" }, { "q": "8", "t": "p", "v": "25", "c": "vip" } ] } -
Tech Stack: Shopify Functions with Rust.
-
Goal: Apply dynamic, time-sensitive tiered discounts across variants efficiently.
The Concern:
In our current approach, we’re consolidating rules into a single discountNode for all variants to optimize performance. However, due to challenges with accessing current date/time in the function (as discussed in related threads), we’re considering a pivot to creating one discountNode per variant’s rules. This would ensure more granular control and easier time validation per variant.
For a large store, this could mean significant scale: e.g., 100 products with 50 variants each = 5,000 potential discountNodes.
Question:
Is there a limit on the number of discountNodes (or discount functions) we can create and apply in Shopify? What are the performance implications, API rate limits, or best practices for handling thousands of such nodes? Any guidance on quotas for Functions API calls or storage would be super helpful to evaluate feasibility.
Thanks for your expertise—looking forward to your thoughts!