[Shopify Functions – Order Discounts] How to enforce per-customer discount quota (e.g. 50% off up to $1000)?

Hi everyone,

I’m a developer working on a custom Shopify app (unlisted/private) that uses Shopify Functions – order-discount extension to implement a customer-specific promotion.


:bullseye: Goal:

I want to create a promotion for specific customer groups with the following rules:

  • Logged-in customers can get 50% off at checkout when applying a discount code.
  • However, each customer has a maximum discount quota of $1000 (either lifetime or reset periodically).
  • After each successful checkout, the discount used should be subtracted from their remaining quota.
  • If the 50% discount exceeds their quota, it should be capped at $1000, and the customer pays the rest.

Example use cases:

  • Order value $1200 → 50% = $600 → :white_check_mark: allow full discount
  • Order value $3000 → 50% = $1500 → :cross_mark: only $1000 discount allowed → customer pays $2000

:warning: Challenge:

Since Shopify Functions cannot make external API calls , I’m unable to:

  • Fetch the customer’s current quota from my backend within the Function
  • Update the quota after order completion

This breaks the logic I need for enforcing a per-customer discount limit.


:red_question_mark:Looking for advice on:

  1. How to enforce per-customer discount caps without calling external APIs in the Function?
  2. Has anyone implemented a similar quota-based discount system before?
  3. Is the best way to track usage externally via webhook (e.g. orders/create) and sync quota manually?
  4. Is it viable to store the quota as a metafield on the customer, and read it inside the Function?
  • Does Shopify Functions allow reading customer metafields from RunInput?

:brain: Current workaround idea:

  • Use a customer metafield like customer.discount_remaining to track the quota
  • On checkout, the Function reads this metafield and caps the discount accordingly
  • After order is placed, use orders/create webhook to update the metafield value in my backend

→ But I’m not sure if customer metafields are available in the input payload to the function.


Has anyone found a more elegant or Shopify-recommended solution for this use case?

Any insights or shared experience would be highly appreciated. Thanks in advance!