The Commerce Layer app lets content editors easily link Commerce Layer resources to content data in the Contentful dashboard. Products that are linked from Commerce Layer can be easily previewed via the Contentful web app, making it easier for content editors to use the most recently uploaded products across catalogs and sites.
Commerce Layer is a multi-market commerce API and order management system that lets you add global shopping capabilities to any website, mobile app, chatbot, wearable, voice, or IoT device, with ease. Compose your stack with the best-of-breed tools you already mastered and love. Make any experience shoppable, anywhere, through a blazing-fast, enterprise-grade, and secure API.
The current version of this app allows you to:
- Full-text search for products in Contentful
- Preview selected products in Contentful
- Link one or more SKUs inside Contentful
- Link one or more SKU lists inside Contentful
- Link one or more markets inside Contentful
- Link one or more bundles inside Contentful
-
Create a Contentful account if you haven't yet and set up a new space for your project.
-
Create a Commerce Layer account if you haven't already.
-
If you haven't already, kindly follow this onboarding guide to learn how to set up your Commerce Layer organization and seed with demo data.
-
In the Commerce Layer dashboard, click on the Integrations tab and create an application with the name:
Contentful
and role:Read only
. -
Upon successful creation, you will get a
CLIENT ID
,CLIENT SECRET
, andBASE ENDPOINT
credentials. Kindly remember to save these, as you'll need them later. -
Visit this page and click on the "Install now" button.
-
Choose where to install the app by selecting a Space and Environment.
-
You will be redirected to a new page; now click on the "Install" button to proceed.
-
You will be redirected to a new page; now enter your previously saved Commerce Layer
CLIENT ID
,CLIENT SECRET
, andENDPOINT
credentials to complete the installation. -
Now, you can begin using the Commerce Layer contentful app!
Kindly follow the steps below to set up the Commerce Layer contentful app.
-
Click on the "Content model" tab and add a new content type (e.g., Product or Category).
-
Add a new
Text
field, enter a name (e.g., Product SKU) and select the typeShort text, exact search
. -
Click on the "Create and configure" button.
-
Click on the "Appearance" tab, select the Commerce Layer app, select the right resource you want to fetch (either SKUs, SKU Lists, Bundles, or Markets), and click on the "Confirm" button.
-
Use the same steps above to create all the fields you want, and click on the "Save" button to save the content type.
-
Create new content to test for each resource based on the created content types.
-
Search, select, and link the right resource from Commerce Layer to the content field.
-
Done!
This project was bootstrapped with Create Contentful App and uses Reactjs, Typescript, App SDK, and Forma36 design system. In the project directory, you can perform the following actions using these commands:
- Create or update your app definition in Contentful, and run the app in development mode in the browser. The page will reload if you make edits, and you will see any lint errors in the console.
npm start
- Build the app for production to the
build
folder. It correctly bundles React in production mode and optimizes the build for the best performance.
npm run build
- Upload the build folder to Contentful and create a bundle that is automatically activated. The command guides you through the deployment process and asks for all required arguments.
npm run upload
- Similar to
npm run upload
, it will upload your app to Contentful and activate it. The only difference is that with this command all required arguments are read from the environment variables. For this command to work, the following environment variables must be set:
CONTENTFUL_ORG_ID
- The ID of your organizationCONTENTFUL_APP_DEF_ID
- The ID of the app to which to add the bundleCONTENTFUL_ACCESS_TOKEN
- A personal access token
npm run upload-ci
To contribute to this project, kindly follow the steps below:
-
Fork this repository (you can learn how to do this here).
-
Clone the forked repository like so:
git clone https://github.com/<your username>/commercelayer/contentful-app.git && cd commercelayer/contentful-app
-
Set your environment with a
.env
file using.env.sample
as base. -
Install all required packages using the command
npm install
. -
Run the development server on
localhost:3000
using the commandnpm start
. -
Contentful Apps need to run inside the Contentful web app to function properly. Install the app into a space and render your app into one of the available locations.
-
Create an issue to discuss feature ideas or improvements before working on them.
-
Make your changes, test them, and create a pull request (learn how to do this).
-
Someone will attend to your pull request and provide some feedback.
-
Create an issue in this repository.
-
Ping us on Twitter.
This repository is published under the MIT license.