As requested in [IMPORTANT] Stop creating issues here, use the Shopify Community forum instead · Issue #2521 · Shopify/ui-extensions · GitHub, I am re-raising this issue.
Please find below the details of Supporting Environment Variables for Checkout Extensions · Issue #680 · Shopify/ui-extensions · GitHub
Please list the related package(s)
checkout-ui-extension
Is your feature request related to a problem? Please describe.
App that my team develops is deployed to multiple environments (dev, sandbox, staging, prod, etc).
Whenever, I am deploying app to these environments process becomes very manual.
For each environment I need to go and select the different app and then run deploy command.
Also, inside my extension code, api endpoint will change depending upon the environment.
Whenever, I run yarn dev
for a particular app, I need to go in extension code and change the api endpoint manually. It would be wonderful if you can provide .env file and we can set env vars for shopify app dev
and `shopify app deploy’ commands in the .env file.
Support passing the environment variables to checkout extensions. It is needed if the extension is built for multiple environments and use different APIs.
Describe the changes you are looking for
Ability to pass custom options to shopify app dev
and shopify app deploy
, it could be using either .env file or separate key-value pairs. These environment variables should flow to the checkout extension code and it should be made available to use.
Describe alternatives you’ve considered
Let’s say extension is deployed on 3 environments dev
, sandbox
, and prod
. For each of these envs checkout extension would want to hit different url dev.mydomain.com
, sandbox.mydomain.com
, etc.
But whenever app is deployed, I can’t really specify which env to target.
To achieve this I have defined extension settings, whenever app is deployed I can get value for env from extension settings.
But extension settings are not available when running local dev server. So whenever I run the local dev server, I’ve to go and update the env code. It is really frustrating.
Additional context
Various people have implemented hacks - but first party support would be extremely helpful.