Step 2. Setup environment variables.
To streamline the setup process, we will first list all necessary environment variables required for configuration. Subsequently, we’ll provide detailed instructions on how to obtain each of these variables.
Note: By default, your commerce application runs in demo mode. To access all features, ensure the following variables are set in your
.env.local
or.env
Below is the list of environment variables that you’ll need to configure in your .env.local
file for the proper setup of your enterprise commerce system:
Replace all environment variables with the actual values that you will obtain through the setup process described below.
1. Shopify Store Domain
Variable Required:
PUBLIC_STORE_DOMAIN
How to Obtain:
Your Shopify store domain is the URL of your Shopify store. You can obtain it in the Shopify dashboard, it should be without
https
and/
at the end of the string. Example:cool-socks.myshopify.com
2. If you are using the Hydrogen App
(skip step 3 below)
Hydrogen App
(skip step 3 below)Variable Required:
PRIVATE_STOREFRONT_API_TOKEN, PUBLIC_STOREFRONT_API_TOKEN, PUBLIC_STORE_DOMAIN, PUBLIC_CUSTOMER_ACCOUNT_API_CLIENT_ID, PUBLIC_CUSTOMER_ACCOUNT_API_URL, SESSION_SECRET
andPUBLIC_STOREFRONT_ID
Installation and Configuration:
Visit the Shopify Marketplace and search for the Hydrogen commerce application or navigate directly to https://apps.shopify.com/hydrogen
Install the application, open it, and create a new Storefront within the app, and connect to your hydrogen GitHub repo. If you're testing in the development store, use the Headless app instead.
Select Hydrogen storefront and then click the Storefront settings button. In Storefront settings, you can see environment variables
PRIVATE_STOREFRONT_API_TOKEN, PUBLIC_STOREFRONT_API_TOKEN, PUBLIC_STORE_DOMAIN, PUBLIC_CUSTOMER_ACCOUNT_API_CLIENT_ID, PUBLIC_CUSTOMER_ACCOUNT_API_URL, SESSION_SECRET
andPUBLIC_STOREFRONT_ID
already set up. You just need to copy them and replace them in your .env.local file if you want to run the project on localhost.
3. If you are using the Headless App
(skip step 2 above)
Headless App
(skip step 2 above)Variable Required:
SHOPIFY_STOREFRONT_ACCESS_TOKEN, PRIVATE_STOREFRONT_API_TOKEN, PUBLIC_CUSTOMER_ACCOUNT_API_CLIENT_ID, PUBLIC_CUSTOMER_ACCOUNT_API_URL
You can only operate this application in development mode at localhost or when you want to host the Hydrogen application yourself without hosting it at Oxygen. In the context of the Ciseco project, I will support you best when you implement the project with Oxygen.
Installation and Configuration:
Visit the Shopify Marketplace and search for the Headless commerce application or navigate directly to https://apps.shopify.com/headless.
Install the application, open it, and create a new Storefront within the app.
In the “Manage API Access” section, click on the
Manage
button next to Storefront API.Make sure you have enabled
unauthenticated_read_product_inventory
,unauthenticated_read_metaobjects
, andunauthenticated_read_customer_tags
scopesCopy the Public access token and Private access token displayed and place them in your
.env
file underPUBLIC_STOREFRONT_API_TOKEN
andPRIVATE_STOREFRONT_API_TOKEN
.Go back and in the “Manage API Access” section, click on the
Manage
button next to Customer Account API.Copy the Client ID displayed and place them in your
.env
file underPUBLIC_CUSTOMER_ACCOUNT_API_CLIENT_ID
Scroll to the Application endpoints section, copy the Authorization endpoint as "https://shopify.com/1234567889/auth/oauth/authorize", but remove the "/auth/oauth/authorize" path, and keep the API account URL "https://shopify.com/1234567889" and place it in your.env
file underPUBLIC_CUSTOMER_ACCOUNT_API_URL
4. Shopify Store CDN Static Url and Product options image format (Optional) Display the color variant options as image swatch
Variable Required:
PUBLIC_STORE_CDN_STATIC_URL, PUBLIC_IMAGE_FORMAT_FOR_PRODUCT_OPTION
How to Obtain:
This is only useful if your products have Color variations, otherwise, you can skip this step and leave these 2 env variable values blank.
The Ciseco theme will display product color options with images. So, when your products have Color variations with values like: "Black", "Red", "Pink and White", etc. Then you will need to upload image files with the same name as those color values (replace spaces with underscores): Red.png, Pink_and_White.png... However, you can use images in png, jpg, jpeg, svg or webp... as desired. You just need to replace the format for the variable
PUBLIC_IMAGE_FORMAT_FOR_PRODUCT_OPTION
You can find this value by going to Content -> Files, then copying the link of any image, you will get a link like this: "https://cdn.shopify.com/s/ files/1/1234/1234/1234/files/image.jpg?v=123456789", remove the name "image.jpg?v=123456789" and keep "https://cdn.shopify.com/s/ files/1/0586/7674/0198/files/", then copy and place into variable
PUBLIC_STORE_CDN_STATIC_URL
Please note, it should be withhttps
and/
at the end of the string.
5. Okendo App Subscriber ID (Optional)
Variable Required:
PUBLIC_OKENDO_SUBSCRIBER_ID
How to Obtain:
This is only useful if you want to use the product review feature of the Okendo app. Otherwise, you can skip this step and leave the variable value blank.
Installation and Configuration:
Visit the Shopify Marketplace and search for the Okendo: Product Reviews & UGC application or navigate directly to https://apps.shopify.com/okendo-reviews
Install the application, open it, and click the Open Okendo Platform button.
On Okendo App > Settings > Integrations > Credentials > Okendo > Click edit button then copy the User ID and place it in your
.env
file underPUBLIC_OKENDO_SUBSCRIBER_ID
Expose Shopify Metafields: Okendo Reviews uses Product and Shop metafields. You will need to expose these metafields so that they can be retrieved by your Hydrogen app.
At the moment, Shopify does not have a way of exposing Shop Metafields through their admin UI, so the preferred method is to contact Okendo Support and ask them to Expose Shopify Metafields for you, they will quickly and enthusiastically help you.
Last updated