Drupal Commerce

Posted : admin On 1/26/2022

In this first in a series of Drupal Commerce Guides, we work through setting up the relevant Drupal CMS modules and taking the first steps in our e-commerce site creation tutorial. To get started, we need to understand what Commerce's Product and Product Types are, as well as how to implement them.

Understanding Products and Product Types

Led by developers Armando Codina and daughter Ana-Marie Codina Barlick, Codina Partners is a real estate investment and development firm driving the successful transformation of South Florida’s communities into more vital, prosperous centers for living, working, culture and commerce. Drupal Commerce is revolutionary software integrating commerce, content and community to create engaging Web experiences that bring e-retailers more traffic to drive more results. With Drupal Commerce, online retailers have a simple yet powerful platform and the flexibility to integrate a rich commerce experience anywhere within their environment.

Let’s say you own a boutique with an online e-commerce store where you might sell gift baskets, wine, and perhaps tickets to special events. These are your Product Types and to put it simply, they are just the types of Products that you sell. Within these Product Types, you sell may sell a variation of individual Products. For instance, within a wine Product Type, you may sell a Pinot Noir wine and a Pinot Blanc wine. Pinot Noir and Pinot Blanc are individual Products of the Product Type wine. A Product Type is not unlike a Content Type in many ways. In fact, it was Drupal 7's entity system that inspired the team behind the project, Commerce Guys, to structure and build Drupal Commerce using entities. In Drupal Commerce, a Product Type is a specific bundle based on a custom product entity much like my example with wine. Each bundle can have fields attached to it with product attributes and variations to further define Products, much like you would define fields in Content Types.

Products can be easily compared to Nodes as well. They're product content added to their respective Product Types.

Module Installation

In this tutorial, I'm assuming that you already know how to download and install modules, so I've foregone those steps. Here's a one-liner for Drush to grab the stable/suggested version and dependencies:

Drupal Commerce

Required Modules

Drupal commerce api

Dependencies

For reference, I've enabled all Commerce related modules for this Drupal Commerce tutorial.

I’ve installed a few unrelated modules that you may see in my tutorial video above. Those include:

Create a Custom Product Type

Let's begin adding a Product Types in Drupal Commerce. When you enabled the Product UI module earlier, a basic Product Type was created. A basic Product Type includes:

  • a product SKU
  • the title of the product
  • a price field
  • a status field

Let's create a custom Product Type.

Navigate from Administration Store Products Product Types. Select Add Product Type.

Configure the Product Type, then select: 'Save and add fields.'

The base Product Type fields are created by default when you add a new Product Type, see below. Add fields to customize your Product Types.

For my wine Product Type, I've added an image field and a List (text) field to define my wine type. These two fields are known as informational field variations. In other words, these fields will not alter the price of my Product. Instead, these fields will provide additional information about my Product.

I'll also add a List (text) field for a vintage selection. My vintage selection will alter how the Product looks and the price of my Product, however. Therefore, I will select 'Enable this field to function as an attribute on the Add to Cart forms.'

Drupal Commerce Dimensions

Next, adjust the Display settings on your Product Type. Choose Manage Display and adjust accordingly. Typically, I hide the Product SKU, Status, and most Field Labels. Save and begin adding your Products.

Drupal E-commerce

Add Products to your new Product Type

Navigate to Administration Store Products Add a Product. Enter the Product information and save.

Drupal Commerce

Drupal Commerce Paypal

Once you've added your Products, it's time to learn about creating Product Displays to make your Products available to your customers.

Reach out If you're interested in having us build an e-commerce solution in Drupal for you or your organization. Think this tutorial is useful? Don't forget to share!

Drupal Commerce Module

Sources and further reading:
https://www.drupalwatchdog.com/volume-1/issue-1/building-drupal-commerce...
https://drupalcommerce.org/user-guide/products
https://drupalcommerce.org/user-guide/product-displays
https://drupalcommerce.org/user-guide/product-attributes-variations

Drupal Commerce Tutorial

This is part of a tutorial series on Drupal Commerce. See more below:
Tutorial: Creating Product Types and Products in Drupal Commerce
Product Display: Contextual Field Output in Guide
Customizable Products with Drupal Commerce Module Guide​