Last updated November 11, 2013. Created on February 5, 2011.
Edited by Fiable.biz, NonProfit, Scott J. Log in to edit this page.

If your needs are simple, the default product type called Product that is installed for you, may be all that you require. However, if you wish to sell products with different attributes, such as sizes or colors, then you may need to create different product types.

Add vocabulary

Before creating a product type, if you need product attribute to be chosen in a list, like "colour", then you should create a vocabulary (thanks to core module Taxonomy). Click on Structure → Taxonomy → Add vocabulary Click on 'Add vocabulary'
(admin/structure/taxonomy/add).
 'Product color'
Then save, click on "Add terms" Click on 'Add terms' then type and save your terms one by one. Typing 'black'

Add a product type

To add a product type (in case the default one is not enough for you), navigate to Add product type (Store > Products > Product type (tab) > Add product type, or http://example.com/admin/commerce/products/types/add) Click on 'Add product type'
and enter a name such as "T-shirt" or "Coffee Table", then click Save and add fields.

Manage Fields

Next we need to add fields to our new product type to represent the attributes of our products. You should be on the Manage Fields tab of your product type (Store > Products > Product type > Add product type > Manage Fields Tab, or http://example.com/admin/commerce/products/types/[YourProductType]/fields).

You will see that some default fields have already been added for you:

  • Product SKU
  • Title
  • Price (if Price module is enabled)
  • Status

Add new fields as needed, for example:

  • Image
  • Color
  • Size

Manage Display

By clicking the Manage Display tab (Store > Products > Product type > Add product type > Manage Display Tab > Default Sub Tab, or http://example.com/admin/commerce/products/types/[YourProductType]/display) we can change the way the fields for our product type will be displayed. You can use the "Custom Display Settings" to enable various custom display types. This allows you to define custom displays for nodes, teasers, line items (cart/checkout), and admin pages.

AttachmentSize
product_type.jpg21.34 KB
add_vocabulary.jpg18.99 KB
new_vocabulary.jpg15.56 KB
add_terms.jpg39.87 KB
adding_color_black.jpg38.36 KB

Looking for support? Visit the Drupal.org forums, or join #drupal-support in IRC.

Comments

ahhao’s picture

may i know what type of field i should use for Color and Size?

nessunluogo’s picture

You could want put them in two distinct taxonomy vocabularies, then use Term Reference fields or Entity Reference field.

More easily, use a Text list with a Select widget.

Nessunluogo