Skip to main content
Version: 2.x

Installation

This page explains how to install the Front-Commerce Wordpress module.

Install

The Front-Commerce Wordpress module lives in a dedicated repository. As a result, you first need to install it with npm:

npm install git+ssh://git@gitlab.blackswift.cloud/front-commerce/front-commerce-wordpress.git
tip

We recommend to use a specific version of this module and not to blindly rely on the latest version.

Configure

This module requires the FRONT_COMMERCE_WORDPRESS_ENDPOINT environment variable to be set with the URL of your WordPress instance (without a trailing slash):

.env
FRONT_COMMERCE_WORDPRESS_ENDPOINT=https://wordpress.example.com

Then the module must be enabled in your .front-commerce.js. The Front-Commerce Wordpress module comes with two main GraphQL modules:

  • WordPress/Blog brings a blog to your Front-Commerce project
  • WordPress/Cms exposes the CMS pages from Wordpress.

Depending on your project you can use both or only one of these GraphQL modules.

note

In any case, you also need to enable the WordPress/Core module.

.front-commerce.js
module.exports = {
name: "Front-Commerce Skeleton",
url: "http://localhost:4000",
modules: [
"./node_modules/front-commerce-wordpress/front-commerce-wordpress",
"./src",
],
serverModules: [
{ name: "FrontCommerce", path: "server/modules/front-commerce" },
{ name: "Magento2", path: "server/modules/magento2" },
{
name: "WordPressCore",
path: "front-commerce-wordpress/server/modules/wordpress/core",
},
// if you want a blog
{
name: "WordPressBlog",
path: "front-commerce-wordpress/server/modules/wordpress/blog",
},
// if you want to expose Cms Pages from Wordpress
{
name: "WordPressCms",
path: "front-commerce-wordpress/server/modules/wordpress/cms",
// if your Front-Commerce project is connected to a Magento1 instance, you
// need to use the following path instead
// path: "front-commerce-wordpress/server/modules/wordpress/cms/index.magento1.js",
},
],
webModules: [
{ name: "FrontCommerce", path: "front-commerce/src/web" },
{
name: "Wordpress",
path: "front-commerce-wordpress/front-commerce-wordpress/web",
},
{ name: "YourProject", path: "./src/web" },
],
};

After these changes, you need to restart Front-Commerce.