BUSINESS CASE

CLIENT CHALLENGE

To enable flexibility to manage various product attributes like color, size, weight, height, etc. from the Drupal CMS backend.

WEBLINE SOLUTION

As we know Drupal is popularly used for CMS based websites. However, Drupal is also widely used to develop ecommerce websites mainly because “Drupal Commerce” is a module which does the job of extending Drupal framework’s strength to eCommerce platform.
So we used Drupal Commerce to develop ecommerce site in drupal for our client. Once that was done then there was a need to manage the product attributes from the backend without any help required from Drupal development team.
There are mainly 2 ways to manage custom attributes of products in Drupal. We will see how to use both of them in this tutorial.

Adding attributes manually through Add Field.

Adding attributes using Taxonomy.

Before moving further, I am assuming reader of this tutorial is either a Drupal developer or knows how to develop site in Drupal.

1. Adding Attributes manually through Add Field

Assumption is there is already a product available. So next is we will edit a product type which we can find under Administration » Store » Products » Product types

Click to “Manage Fields” tab and add new custom field with name as ‘Size’ or ‘Color’.

Then we will make this new field’s field type as “List(text)” and click on Save.

Then open “Field Settings” page and add “Key|Value” in Allowed values list text-area.

E.g.
1|Red
2|Green

Click – Save field settings

Next step is to open field settings page and we have to check “Enable this field to function as an attribute field on Add to Cart forms” option to display this new field on the UI (front-end).

To assign more than one value of this attribute to single product select “Unlimited” from “Number of values” drop-down.

So this is how we can add custom product attributes from the product section.