5.1 Downloading and installing Drupal Commerce.
First of all, to install Drupal Commerce, you’ll need Composer:
https://getcomposer.org/download/
Composer is a package manager for PHP. It allows you to download and include PHP libraries in your project’s autoloader — in this case, for your Drupal 8 site. Drupal 8 already includes many third-party libraries, especially from the Symfony framework.
Composer typically installs without issues — just make sure Open Server or another local web server is running before you begin. During installation, keep clicking “Next” and Composer will install itself.
After installation, open a terminal and run:
composer --version
You should see the installed Composer version:
$ composer --version Composer version 1.4.1 2017-03-10 09:29:45
You can use either the built-in Windows CMD console:
Or the Open Server console:
A full lesson on using the console will be available soon. Meanwhile, the following steps should help you install Drupal Commerce.
Installing Drush
Drush is a command-line tool for working with Drupal. It’s convenient for downloading and enabling modules. Ideally, you should use Composer to download modules and then enable them with Drush.
composer global require drush/drush:8.*
Replace 8.*
with the version you need (e.g., 9.*
). To confirm that Drush installed correctly, run:
drush version
Example output:
$ drush version Drush version : 9.0-dev-g9ec6aa42
If you encounter issues with Drush installation on Windows, refer to this guide:
12.1. Installing Drush 8 on Open Server
Installing Drupal 8
If you already have a working Drupal 8 site, skip this step and proceed to Commerce installation. Otherwise, download Drupal core from drupal.org and set up a new site using Open Server.
To install Drupal faster using Drush:
drush si --db-url=mysql://root@127.0.0.1/commerce --account-name=admin --account-pass=admin --site-mail=admin@example.com --site-name="Drupal 8 Commerce" --locale=ru --yes
This command sets the admin username/password/email and database settings. If the commerce
database doesn't exist, Drush will create it or overwrite the existing one.
Drush installation takes ~3 minutes, whereas a browser-based install might take up to 10 minutes with translation downloads.
Restart Open Server and check that Drupal is working:
Installing Drupal Commerce via Composer
Navigate to your site folder in the terminal and add the Drupal packages repository:
composer config repositories.drupal composer https://packages.drupal.org/8
Then install Drupal Commerce:
composer require "drupal/commerce 2.x-dev"
Composer will automatically fetch necessary Drupal modules and PHP libraries:
Enable Commerce Modules
drush en commerce commerce_cart commerce_checkout commerce_order commerce_price commerce_product commerce_store address entity inline_entity_form
If some modules fail to enable via Drush, you can enable them manually through the admin UI: