How to Get Discount Codes already applied in Shopify Function input?

Topic summary

Shopify Functions input for product discounts does not expose applied discounts or coupon codes, preventing logic that depends on the entered code or pre-existing discounts. A provided GraphQL query and input log show cart costs unchanged despite a 30% code (EXTRA) applied, confirming the function cannot “see” the discount.

Requested use cases:

  • Adjust discount percentage based on the entered discount code plus product tags (e.g., EXTRA20 + tag “Sale” → increase to 30%).
  • Determine free shipping eligibility based on pre-discount subtotal (e.g., purchases over $500 qualify even if a $300 code reduces the checkout total below $500).

Shopify staff acknowledged the need, asked for context, and said they would relay feedback, hinting at upcoming releases but providing no timeline. Multiple participants asked when discount code access will be available.

One workaround was suggested for shipping thresholds via a third-party app (Better Free Shipping), which can base eligibility on subtotal before discounts.

Status: no native solution yet; feature request remains open with no ETA. Code snippets and logs are central to understanding the issue.

Summarized with AI on December 28. AI used: gpt-5.

The Merchant is asking us to replicate what we did with Shopify Scripts.

Logic:

Increase or Decrease the % of discount based on:

  • Entered Discount code

  • Product Tag

Example:

  • User entered the Coupon Code EXTRA20 (20% discount)

  • The Product has tag Sale (will get an extra 10% Off)

Result: We increase the Discount to 30%