Quick Start
Blaze Commerce is how WooCommerce stores go headless with ease. Our open-source platform covers everything from seamless integration and blazing-fast performance to exceptional user experience and SEO optimization for thriving in today’s competitive market.
The following quick start guide is intended to get a headless instance of your Woo store up-and-running in about 15 minutes. It won't look too pretty, but it'll showcase the key elements of Blaze Commerce.
The following guide is broken into the following steps:
- Setup a Typesense instance for where all the data necessary for creating your headless store will reside
- Install the Blaze Commerce plugin and dependent plugins on your WP/Woo store
- Configure the Blaze Commerce plugin
- Deploy Blaze Commerce locally
- Deploy Blaze Commerce with Vercel
Watch: Deploy a Headless WooCommerce Store in 15 Minutes
Prefer to watch instead of read?
Check out this step-by-step video tutorial where I walk through deploying a headless WooCommerce store using Blaze Commerce in around 15 minutes.
More info about this video guide at Headless WooCommerce: A Comprehensive Guide to Supercharging Your Store (opens in a new tab)
Prerequisites
Software Requirements
- Node.js (Latest Version) (opens in a new tab) - Ensure that Node.js is installed on your local machine. This is required for running the frontend locally.
- Running WP/Woo site - This will serve as the backend and where we host the data and user checkout.
Required Accounts
- Github (opens in a new tab) Account - For accessing the project repository.
- Vercel (opens in a new tab) Account - Used for deploying the frontend to a staging URL.
- Typesense (opens in a new tab) Account - Required for search functionality. You’ll need to create API keys for both admin and search operations.
Site Domain Configuration
We’ve chosen to prioritize the front-end development of Blaze Commerce. Since both the 'front-end' and checkout require significant work, we've decided to focus on perfecting the user experience on the front-end first. Checkout-related features are on our roadmap, and we'll tackle them in future updates.
Blaze Commerce requires a separate subdomain for checkout. This allows for more efficient management of the purchasing flow until we roll out those improvements.
If your main site domain is example.com
, set the WordPress domain to cart.example.com
.
Note: While "cart" is a common choice, you're free to use any subdomain that fits your needs (e.g., checkout.example.com
or shop.example.com
). Just remember to update any references to cart.example.com in this guide if you use a different subdomain.
Typesense
Typesense is a brilliant open source alternative to Algolia, and is used to deliver the search functionality, providing an instant search experience with typo-tolerance and fast auto-complete suggestions. It's also used for generating the category views and filtering, and is also the repository for all data and configuration options for the headless frontend.
You can use their 14 day free trial with their cloud offering or use their open source project.
Typesense Cloud
The following steps have you create a free trial with Typesense Cloud and grab the necessary credentials for using it with Blaze Commerce.
Create an account on Typesense Cloud
- Go to https://cloud.typesense.org/ (opens in a new tab)
- I would suggest to signup with GitHub as that is the easiest and the fastest
- Authorize Typesense to continue
- You will be redirect to Typesense to create a new Cluster
Creatin a new Cluster and API keys
- Login to your Typesense Cloud using GitHub if you are not logged in. If you have followed the steps above you should be in https://cloud.typesense.org/clusters/new (opens in a new tab)
- Click Launch
- After the creation of new cluster you will be in a screen with a pink button "Generate API Keys". So click it after the cluster is created and initialized
- Once you click "Generate API Keys". it will download a text file containing the following
- Admin API Key: we use this as the API Key in Blaze Commerce
- Search Only API Key: we use this in our frontend repo
- Nodes: we use this as the Typesense host in Blaze Commerce
Creating api key
If for some reason you can't continue the process from above then just create the API Key manually by following the steps below
- Login to your Typesense cloud https://cloud.typesense.org/login (opens in a new tab)
- you will be redirected to all your clusters https://cloud.typesense.org/clusters (opens in a new tab)
- Click the Cluster you recently created
- The button to generate api keys should be under API Keys tab. See image below
Typesense Open Source
If you prefer to use their open source project and/or use one of their preconfigured containers, their Typesense Guide (opens in a new tab) is the place to start.
Note: Our Blaze Commerce WP plugin requires an SSL connection with Typesense, so be sure to add a cert (opens in a new tab) to your Typesense instance.
Install WP Theme & Plugins
Now we need to install the handful of plugins necessary to support your new headless frontend.
Theme
- GeneratePress (opens in a new tab) - We currently only support this theme at the moment. Please install and activate this theme.
Plugins
Install and configure (where necessary) the following plugins.
Step 1. WPGraphQL
WPGraphQL is a free, open-source WordPress plugin that adds a GraphQL API to your WordPress site. This allows developers to query WordPress data in a more flexible, efficient way, compared to traditional REST APIs. It's ideal for headless WordPress setups and works seamlessly with WordPress content structures.
Project Link: https://www.wpgraphql.com/ (opens in a new tab)
Installation: Install and activate via the the WordPress plugin installer by searching wpgraphql
.
Step 2. WPGraphQL CORS
WPGraphQL CORS is a WordPress plugin that provides Cross-Origin Resource Sharing (CORS) support for WPGraphQL. It ensures that your WPGraphQL queries can be securely accessed from external domains, which is essential for headless WordPress and third-party integrations.
Project Link: https://github.com/funkhaus/wp-graphql-cors (opens in a new tab)
Installation: Download the WPGraphQL CORS (opens in a new tab) plugin from GitHub, then Install and activate it on your site.
Configure WPGraphQL CORS
Go to GraphQl ➝ Settings ➝ CORS Settings
- Enable
Add Site Address to "Access-Control-Allow-Origin" header
- Extend
Access-Control-Allow-Origin” header
and add the following, replace example.com with your domain* https://example.com
- For
Extend "Access-Control-Allow-Headers”
addset-cookie woocommerce-session
- Enable
Send site credentials.
- For
Samesite cookie mode
selectLAX
- For
Cookie domain
add localhost or your domain with the dot. See example below.example.com
Step 3. WPGraphQL JWT Authentication
WPGraphQL JWT Authentication is a WordPress plugin that adds JSON Web Token (JWT) authentication capabilities to WPGraphQL. It allows secure authentication for GraphQL queries by issuing and validating JWT tokens, providing a robust and scalable way to authenticate users in headless WordPress environments.
Project Link: https://github.com/wp-graphql/wp-graphql-jwt-authentication (opens in a new tab)
Installation: Download the WPGraphQL JWT Authentication (opens in a new tab) plugin from GitHub, then Install and activate it on your site.
Step 4. WooGraphQL
WooGraphQL is an extension of WPGraphQL that brings WooCommerce functionality into the GraphQL API. It enables developers to query and mutate WooCommerce data, such as products, orders, and customers, through GraphQL, making it a key tool for headless WooCommerce stores.
Project Link: https://woographql.com/ (opens in a new tab)
Installation: Download and activate WPGraphQL WooCommerce (WooGraphQL) from one of the following options:
- PHP 8.x: WooGraphQL 0.21.0 (opens in a new tab) (2024-08-07)
- PHP 7.x: WooGraphQL 0.19.0 (opens in a new tab) (2023-12-27)
Step 5. GenerateBlocks
GenerateBlocks is a lightweight WordPress plugin that gives you four powerful blocks to build almost any type of content layout. It's used by Blaze Commerce for composing header, footer and homepage elements with blocks.
Project Link: https://wordpress.org/plugins/generateblocks/ (opens in a new tab)
Installation: Install and activate via the the WordPress plugin installer by searching generateblocks
.
Step 6. Rename Plugin Folders
When installing WPGraphQL CORS, WPGraphQL JWT Authentication and WPGraphQL WooCommerce (WooGraphQL) the version number is included in the folder name:
You need to rename those folders to remove the version numbers:
Once this step is completed you should then proceed to the next step.
Step 7. Blaze Commerce WP Plugin
The Blaze Commerce WordPress plugin ensures seamless synchronization between WordPress and your Headless WooCommerce instance.
Project Link: https://github.com/blaze-commerce/blazecommerce-wp-plugin (opens in a new tab)
Installation: Download the Blaze Commerce WP Plugin (opens in a new tab) plugin from GitHub, then Install and activate it on your site.
Note: if you're getting a This plugin cannot be activated because required plugins are missing or inactive.
or similar, make sure you've completed the previous step and renamed plugin folders.
Configuring Blaze Commerce Plugin
- Go to Blaze Commerce ➝ General Settings in the WordPress admin sidebar
- Enable
Enable System
API Key
is the Admin API Key from Typesense from above stepsTypesense Host
is the Typesense node's domain name - This is a naked URL withouthttps://
. Note that we only support https connections, so if you're using Typesense Open Source you'll need to add an ssl cert.- Set
Store ID
to 1 - We use store id to identify a store collection in your Typesense cluster. This allows you to use one cluster for different websites. If you have used store id 1 from another site then use another number to avoid conflict. Shop domain
- this is the frontend domain for your site. Please check Site Domain configuration above. It should exclude https and slashes. egexample.com
- Click
Save Changes
- Enable
- Go to
Regional settings
tab- Add your region (this should have zero impact on visitors to your stie - it's for multicurrency, but must be configured for single currency sites for now)
- After entering a region, you'll be presented with a
Map Regions
option - add your country here. - Click
Save Changes
- Return to the
General
tab and clickSync All
- this link will only show after saving valid Typesense credentials from the above step.
Running Blaze Commerce Frontend Locally
Follow this step if you want to install the headless frontend in your local.
Clone repository
- Go to https://github.com/blaze-commerce/headless-woocommerce (opens in a new tab) and clone the repository in your local
git clone https://github.com/blaze-commerce/headless-woocommerce.git
Configure environment variables
-
Go to where you saved the cloned files
-
Create a new file name within the root directory called
.env.local
- The
.env.local
file must have the following variables - IMPORTANT: Change
example.com
to your wp url.
NEXT_PUBLIC_WORDPRESS_SITE_URL="https://cart.example.com" NEXT_PUBLIC_GRAPHQL_URL="https://cart.example.com/graphql" NEXT_PUBLIC_CHECKOUT_URL="https://cart.example.com/checkout" NEXT_PUBLIC_LIVE_URL="https://example.com" NEXT_PUBLIC_COOKIE_DOMAIN=".example.com" NEXT_PUBLIC_TYPESENSE_PUBLIC_KEY="BYkmODoUgE12mCQEsW1LlzTClMR9UZBt" NEXT_PUBLIC_STORE_ID="1" NEXT_PUBLIC_TYPESENSE_HOST="k0ao6lubzq75gpw1p-1.a1.typesense.net"
- The
-
NEXT_PUBLIC_WORDPRESS_SITE_URL
- this is the WordPress site url. -
NEXT_PUBLIC_GRAPHQL_URL
- this is the graphql url found in wp-admin ➝ GraphQL ➝ Settings ➝ GraphQL Endpoint -
NEXT_PUBLIC_CHECKOUT_URL
- this is the checkout url of WooCommerce -
NEXT_PUBLIC_LIVE_URL
- this is the frontend URL you choose for the frontend when deployed publicly. Usually we just removehttps://cart.
fromNEXT_PUBLIC_WORDPRESS_SITE_URL
-
NEXT_PUBLIC_TYPESENSE_PUBLIC_KEY
- This is the Typesense 'Search Only API Key'. -
NEXT_PUBLIC_STORE_ID
- this is what you set from Blaze Commerce ➝ General Settings ➝ Store Id -
NEXT_PUBLIC_TYPESENSE_HOST
- This is the Typesense Node URL. the same information you entered from Blaze Commerce ➝ General Settings ➝ Typesense Host -
NEXT_PUBLIC_COOKIE_DOMAIN
- this is your wp url withouthttps://cart
- if your wp url is
https://cart.example.com
thenNEXT_PUBLIC_COOKIE_DOMAIN
is.example.com
- if your wp url is
Commands to run the frontend locally
- If you haven't install node.js https://nodejs.org/en/download/package-manager/current (opens in a new tab) please download and install it in your local machine
- Once you have node.js installed. Install yarn by opening a command promp and execute the command
npm install --global yarn
. Click here (opens in a new tab) for details about installing yarn - Go to where you save the files and open command prompt and run the following commands
yarn install
- this will install all the dependencies we had for the frontend.yarn prebuild
- this will gather the data needed from wp site to the run the site.yarn dev
- this will run the project locally
Running Blaze Commerce on Vercel
The following steps are required to deploy Blaze Commerce on Vercel and be publicly accessible.
Requires the following account
- Vercel Account (opens in a new tab)
- Github account/repository (opens in a new tab)
- A WordPress WooCommerce store - ideally a staging version of your live site.
- Login to your GitHub account
- Fork our headless-woocommerce (opens in a new tab) repo https://github.com/blaze-commerce/headless-woocommerce/fork (opens in a new tab)
- Sign up/ Login to Vercel using your GitHub account
- Add a new project - see
- Click install so that your repository can be connected to Vercel
- Click Import for headless-woocommerce
- Open the the
.env.local
file from the previous step above. - Paste the values into the 'Environment Variables' in the Vercel project.
- Click Deploy - This will start the deployment process
- Go to
Settings > Domains
and configure the Vercel project to use your own domain.
You should now be able to access your headless Woo store via your chosen URL.
Who is using Blaze Commerce?
Gourmet Baseket (opens in a new tab), Jackie Mack Designs (opens in a new tab), Admerch (opens in a new tab)
Need help?
If you have any problems with this guide, please reach out to us on our Slack channel (opens in a new tab) and we'll do anything we can to help.