Extending

One of the primary strengths of both Commerce and Drupal is that they are open source projects. There is a large, active community of developers who contribute to these and related projects. As a result, you will find that it's easy to extend Commerce with freely available, "contributed" modules. And if you can't find something to meet your needs, you can always create your own modules as well. Contributed modules as well as extensive documentation about extending your Drupal site can be found on drupal.org. A good place to start is Extending Drupal 8.

For Commerce, you can find everything from modules that provide major types of functionality to smaller modules that provide unique, specialized functionality. For example:

Extending your composer-managed site with additional modules is a straightforward process. Each Drupal module has its own project page on drupal.org with information and instructions. To add a module using composer, the command is:

composer require drupal/commerce_shipping --prefer-dist

Where commerce_shipping is the name of the module you want to add to your project. Composer will add the module as well as all of its dependencies.

Then you can install the module using the Admin UI (/admin/modules) or Drupal console:

The instructions below use [Drupal Console]

drupal module:install commerce_shipping

Adding custom modules from GitHub

Many Drupal developers use GitHub for their initial module development work. So you may find that a module you'd like to use to extend your site is available on GitHub but not on Drupal.org. So how do you add that custom module to your composer-managed site? You can use Composer Installers, a multi-framework composer library installer. Please see How to download a module hosted on GitHub via composer.json? on Drupal Answers for a good example of how to do this.

If you are developing custom modules locally yourself, see Managing dependencies for a custom product for an explanation of using Composer to manage your dependencies.

Found errors? Think you can improve this documentation? edit this page