Translating Dynamic Coupon Codes in Shopify (Need Guidance)

Hi everyone,

I’ve been exploring ways to translate coupon/discount codes based on the customer’s country and language using Shopify Functions and the GraphQL Input API (Localization object). Most of the available approaches seem to work well for static discount messages, where translations are predefined in JSON files or mapped directly in the function code.

However, my requirement is slightly different:

:backhand_index_pointing_right: We need to support dynamic coupon codes, where:

  • The discount message/title is not fixed

  • It may be generated dynamically (e.g., based on campaign, user segment, or runtime logic)

  • And still needs to be translated based on the buyer’s locale

What we’ve explored so far:

  • Using localization.language.isoCode in Shopify Functions to detect language

  • Maintaining locale-based mappings (e.g., fr, de, etc.)

  • Using a locales folder with JSON files

  • Translate & Adapt app / Translations API

Challenge:

All of the above approaches assume predefined/static strings, but in our case:

  • The coupon content is dynamic

  • We cannot predefine all possible translations in advance

What we’re looking for:

  • Best practices for handling dynamic translation inside Shopify Functions

  • Whether it’s possible to:

    • Fetch translations from an external service at runtime (or is that restricted?)

    • Pass translated content via metafields or input payload

  • Any recommended architecture or workaround for this use case

If anyone has implemented something similar or has insights on handling dynamic, locale-aware discount messages, I’d really appreciate your guidance!

Thanks in advance :raising_hands: