1.0.1 • Published 3 years ago

rsf-commercetools-connector v1.0.1

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

commercetools Connector

This guide covers how to get up and running with the commercetools Connector. For information on connectors in general and how to write your own connector refer to the React Storefront Connectors documentation.

Requirements

You will need a commercetools site and API client setup to try out the connector.

Running Locally

Create a new React Storefront app using version 8.14.0 or later:

npm create react-storefront@^8.014.0 my-sfcc-app

Next cd into your created application and install the commercetools connector:

cd my-sfcc-app
npm install react-storefront-commercetools-connector

Next configure the SITE_ID, SHORT_CODE, ORGANIZATION_ID, and CLIENT_ID environment variables in .env file to point to your commercetools site and API client. See .env.sample file as an example of adding env variable via dotenv. You can also check this guide to get more info about Node.js Environment Variables. For example, your .env file may look like:

LEGACY_BACKEND_DOMAIN=www.my-sfcc-site.com
LEGACY_BACKEND_HOST_HEADER=www.my-sfcc-site.com
CLIENT_ID=832ecc65-6fe9-3fcc-a1e2-a222050e0123
ORGANIZATION_ID=f_ecom_abcd_001
SHORT_CODE=4ahl7k9n
SITE_ID=RefArch

Finally set the connector in your next.config.js file. By default this file is set to use the react-storefront/mock-connector as shown below:

module.exports = withReactStorefront({

  // ... Some code

  connector: 'react-storefront/mock-connector',

  // ... More code

Change this line to use the react-storefront-commercetools-connector as shown below:

module.exports = withReactStorefront({

  // ... Some code

  connector: 'react-storefront-commercetools-connector',

  // ... More code

Now you can run your project locally,

npm start

And then visit http://127.0.0.1:3000 in your browser.

Deploying to the Moovweb XDN

The front-end React Storefront can be hosted anywhere that supports Node and Express but it works great on the Moovweb XDN. You can try the XDN for free by signing up here. Once you have an account you can deploy it by running xdn deploy:

xdn deploy

Refer to the XDN deployment guide for more information.