Upgrade Your Drupal Skills

We trained 1,000+ Drupal Developers over the last decade.

See Advanced Courses NAH, I know Enough

Products in Drupal Commerce 2.x

Parent Feed: 

To the average person on the street, a product is something you buy. Say Joe Blow is looking for a T-shirt. Specifically, he wants a blue T-shirt with the logo of his favorite sports team on the front. He goes to an online store, selects the T-shirt with the appropriate logo, chooses the blue color, and indicates the size he needs. Simple. He has now purchased a product.

But in the ecommerce world, a product is much more complicated.

Products: More Than Meets the Eye

If you’re the owner of that online store, you know that every size of that shirt is an individual product that has its own SKU. Knowing whether someone ordered a large or small shirt is important for inventory (so you know how many you have left in stock), pricing (maybe you sell different sizes at different price points), and processing (so you know exactly what has to be shipped). Different colors are also different versions of the same product. So a “product” is really a collection of a whole bunch of products. But when your customers are viewing it, they think of the collection as the single product.

How Drupal Commerce 2.x Handles Products

In 2.x, you have attributes that are used to make up these different products. Each different color is going to be a variation, and each different size is a variation, and each different size + color combination is also a variation. So when you build attributes (size, color, etc.), you actually build products.

You can also have customizations. If Joe Blow wanted his name on that back of that T-shirt, that isn’t really an attribute, because it doesn’t change the product stock. The store would just print his name on a standard T-shirt. That’s an option that gets applied to a product.

Commerce 2.x also lets you set product types, so you can handle physical, digital, and subscription products differently (you don’t need sizes and weights and things for a digital good, for instance).

How This Differs From Drupal Commerce 1

The main difference is that it’s more built in now. In Commerce 1, there were variations, and then you built your own product by making a node (which was actually pretty confusing to a lot of people). In Commerce 2.x, you set up a product, and add variations to it, and it’s a much more structured process that takes you through what you need to do.

The bottom line: products in Commerce 2.x are not vastly different; they’re more of an iterative improvement over Commerce 1.

To learn more, check out our High Five episode “How Drupal Commerce 2.x handles Products.”

Subscribe to our YouTube Channel for more Drupal Commerce goodness!

Author: 
Original Post: 

About Drupal Sun

Drupal Sun is an Evolving Web project. It allows you to:

  • Do full-text search on all the articles in Drupal Planet (thanks to Apache Solr)
  • Facet based on tags, author, or feed
  • Flip through articles quickly (with j/k or arrow keys) to find what you're interested in
  • View the entire article text inline, or in the context of the site where it was created

See the blog post at Evolving Web

Evolving Web