Drupal Commerce Install and Setup

Before installing, here is a list of modules required for Drupal Commerce module:

Installing and Enabling Drupal Commerce

We use Drush to install and enable commerce module as following:

sudo drush dl rules
sudo drush dl views
sudo drush dl entity
sudo drush dl addressfield
sudo drush en rules views entity addressfield
sudo drush dl commerce
sudo drush en commerce commerce_ui commerce_product commerce_product_ui commerce_product_reference commerce_cart commerce_customer_ui commerce_line_item_ui commerce_order_ui commerce_payment commerce_payment_ui commerce_product_pricing_ui commerce_product_pricing_ui commerce_tax commerce_tax_ui

To check which modules are enabled and which not but,perhaps, need to be, run the following:

drush pml | grep commerce

This will display all modules associated with drupal commerce along the status if enabled or not

Summary of all commerce modules:

commerce_tax, commerce_tax_ui, commerce_product_reference, commerce_product_pricing, commerce_product_pricing_ui, commerce_product, commerce_product_ui, commerce_price, commerce_payment_example, commerce_payment, commerce_payment_ui, commerce_order, commerce_order_ui, commerce_line_item, commerce_line_item_ui, commerce_customer, commerce_customer_ui, commerce_checkout, commerce_cart, commerce, commerce_ui.


In the following are steps to set up commerce functionality in the Drupal site:

1. Add Product Type
2. Add Taxanomy

Each taxanomy element is an product attribute such as size, color, etc. Later in the product display page, user will be able to select product attribute and that product will be displayed available to added in shopping cart a functionality that comes with the commerce module out of the box.

3. Add Content Types

This is a Content Type for displaying each product individually

Step-1: Creating Product Types

Go to ‘Admin/Store/Products/Product Types’ and add new product type such as ‘themes’. We are going to sell Drupal themes just like in our store Designs Square

Step-2: Adding Attributes

In order to add attributes to products, we first create these attributes by creating taxanomies for each attribute and adding items that are the attribute values. To add the taxanomies go to ‘Admin/Structure/Taxonomy/Add Taxonomy’

Step-3: Attach Attributes to Product

Go to Product Type(such as ‘theme’) and in ‘manage fields’ section, add a new field with type of ‘Term Reference’. Afterwards, specifying which taxonomy reference is this. Now your product have a product attribute.

!!!make sure select ‘Enable this field to function as an attribute field on Add to Cart forms’ under the ‘Attribute Field Settings’ section, so that when user selects this attribute in the display product page, the product with the particular attributed is displayed and available to add in shopping cart

Step-4: Add Products

To add a product, go to ‘Admin/Store/Products/Add Product’ and select the type of product(i.e. ‘theme’). Do all variations as each separate product

Step-5: Add Displays

1. Create Content Type(for example, ‘Product Display’)
To create Content Type, go to ‘Admin/Structure/Content Types/Add Content Type’ and type ‘Product Display’. Afterwards, add new field with type of ‘Product Reference’ field and select all the product types related to the display (in our case, we have only one product type – ‘theme’ )

2. Add Display for Each Product
Next, we add all of the products each at the time by going to ‘Admin/Content/Add Content/Product Display’, and create a product display(for example, Drupal Newspaper Theme – Newscast). Afterwards, select associated products under the ‘Products Reference’ select box (for example, for the Drupal Newspaper Theme – Newscast we have ‘Basic Light Newscast Theme’, ‘Plus Dark Newscast Theme’,etc )

Test Drive

Without the Payment System configured, you should be able to test it. If your page.tpl.php is customized, make sure you have the default page.tpl.php for the following templates files:

  • page–checkout.tpl.php
  • page–cart.tpl.php
  • page–YOUR-DISPLAY-TYPE.tpl.php

Go to your product display page(Admin/Content/Product_Name) and walk through the checkout process

Configuring Payment System

Required Modules: commerce_payment, commerce_payment_ui
!Consider enabling payments example(commerce_payment_example)

Payment Method 1 – PayPal
A. Set up PayPal account at developer.paypal.com
B. Install PayPal module as follows:

sudo drush dl commerce_paypal
sudo drush en commerce_paypal
sudo drush en commerce_paypal_ec
sudo drush en commerce_paypal_wps

C. Configure payment method. (store->configuration-payement methods)
a) Click ‘enable’
b) Click ‘edit’ and add the email under Payment Settings
!To turn on live, just select radio button for ‘live’
Payment Method 2 – Authorize.Net
1. Create Test Account with Authorize.net
2. Install Module ‘commerce_authnet’
3. following the same steps as configuring PayPal Payment method
Payment Method 3 – Stripe (Our Favorite)
1.create account
2. install drupal module ‘commerce_stripe’
3. Download strip-php lib and put it in sites/all/libraries/stripe-php
4. configuring Payment method
5. Enable Permissions for the not authenticated visitors. Otherwise, the ‘check out’ button will not show up
To see cards available for test see https://stripe.com/docs/testing


Required Modules – commerce_tax, commerce_tax_ui

sudo drush dl commerce_tax
sudo drush en commerce_tax
sudo drush dl commerce_tax_ui
sudo drush en commerce_tax_ui

To add tax rate, go to ‘Admin/Store/Configuration/Taxes/Add tax rate’
Make sure the Rate is in decimal format
Drupal comes with two tax types – Sales and VAT each describing when applied
The ‘Tax rates’ deals with how much of the taxes
The taxes automatically show up at the checkout.


All about orders are in ‘Admin/Store/Orders’
! You can add fields to the orders. To do so go to ‘Admin/Store/Configurations/Orders Settings’


Commerce module also adds the following entities:

  • customer profiles
  • products
  • line items
  • payment transactions

Things to know about Line Items

  • show up in order
  • none taxable
  • cannot create but it is created by modules installed
  • To view line items, go to ‘Admin/Store/Configuration/line items’

Things about Rules

  • example – send email to customer after checkout
  • Good for applying taxes on certain location using rules see Lynda.com

To Set limits on products use Commerce_Stock and go to ‘Admin/Store/Configuration/Stock management’. Once enabled all products, it will have additional field to specify size

Setting Up Email To Notify When Order Received
Go to ‘Admin/Configuration/Workflow/Rules/Send an order notification e-mail/Add New Action/Send Mail’. This will send email whenever an new order is made

Each purchase create customer profile a snapshot of time. good for collecting additional info.

Commerce Product Display Manager Module
To better manage views/admin product displays. See more at https://drupal.org/project/commerce_product_display_manager

Commerce VBO Views
Edit/Create/administer products


1. the ‘attribute field setting’ is missing for the products field with ‘term reference’
Make sure the module ‘commerce_cart’ is enabled

Useful Links

  • http://www.youtube.com/watch?v=gLO7nt48omE&list=UUwY8NJJnQtMs1NBbOTvHdmQ
  • http://www.slideshare.net/willhall/things-i-wish-i-knew-about-drupal-commerce-12546226

3 thoughts on “Drupal Commerce Install and Setup

  1. Pingback: Importing and Exporting Products in Drupal Commerce | Margots Kapacs Blog

Leave a Reply

Your email address will not be published. Required fields are marked *