In this section, we're going to walk through the steps involved in creating a simple product type, one that has a single variation per product. We'll also add an image field for our variation type.
To create a new product type:
This is the name of the product type. The label field is only used for administrative purposes and will not be visible to end users.
The description field is also only used for administrative purposes. It is displayed underneath the product type on the Add product page, located at
/product/add. If your store will have many different product types, entering a description for each can be helpful for product management.
Typically, each product type will have its own corresponding variation type, and you can create both the product type and product variation type at the same time, by selecting Create new for the product variation type on the Add product type form.
However, it is possible for a single product variation type to be used by multiple product types. In that situation, you could select an existing product variation type to be used by the product type you're creating. For example, suppose all your product variations need only the basic title/sku/price fields, but some of your products are manufactured internally while others are outsourced. You might need a variety of different product-level fields in this situation. You could also have different product types because of different marketing needs.
This setting affects how product variation data is entered by administrative users. If enabled, product variations are edited in a form separate from the main product edit form. If a product has only one variation, it can be edited directly on the product data entry form. See the Editing products documentation for more information on product forms.
Published is an option on the data entry form for products and can be checked (published) or unchecked (not published), by default. Also, it is possible to remove the published setting from the product form completely (for all or just a subset of administrative users). You can learn more about the product data entry form configuration options in the Product management section of the documentation.
To access the configuration form for a product variation type, you can either navigate to the Product variation types listing at
/admin/commerce/config/product-variation-types or use the Product variation type links on the Product types listing at
On the Product types listing page, click the link for the Simple product variation type to configure the product variation-level options for the Simple product type.
If you have not created any Product attributes, you should see a configuration form that looks like this:
Select the Generate variation titles based on attribute values setting to keep the data entry for our Simple product type as simple as possible. Click the Save button to save the updated product variation type configuration.
By default, the label for a product variation type is the same as the label for the product type, but the labels do not need to be the same. The label is the name of the product variation type. The label field is only used for administrative purposes and will not be visible to end users.
If you have commerce-related contributed modules installed, you may see additional configuration options. For example, the Commerce shipping module will add a Shippable trait. See the documentation for the contributed modules for information about these traits.
When a product variation is added to the cart, it is added as a new line item. The order item type defines the structure of this line item. (See the order items documentation.)
If you have defined product attributes, they will be listed here. Select any attributes that are applicable to your product variation type.
Custom fields of a variety of types can be added to your product variations. To add a field for one or more images to your Simple product variation type:
On the Field settings configuration page:
You can use the default values for the rest of the Image field settings. If you are interested in learning more about the Image field settings options, see the Drupal 8 documentation for Working with images, which is currently out of date. Until it has been updated, you may find this Image Media Type Manage Fields Tab documentation more helpful.
On the Image settings for Simple configuration page:
Images can now be uploaded for Simple product variations and displayed on product pages. See Product display pages for documentation on customizing product displays.
You can use this same general approach to add other fields to both product and product variation types.
In the next section, we'll look at creating a more complex product type, with product attributes and multiple variations per product.
Found errors? Think you can improve this documentation? edit this page