
Working with product types
In Magento 2, it is still possible to work with different types of products. The standard product is a simple product, which is used to sell basic products, but there are more types available, such as products, where you can choose a size and other options, or download products, virtual products (such as a license), and product combinations.
Getting ready
In this recipe, we will create a configurable product, for example, you want to buy a pair of shoes where you can choose their size and color. Open the Magento backend and navigate to Products | Catalog.
How to do it
In the following steps, we will create a product where we can specify a size on the product detail page:
- Navigate to Products | Catalog, click on the arrow near the Add Product button, and choose Configurable Product as shown in the following screenshot:
- Choose a name, SKU, and price for the product.
- The next step is to decide the attribute on which we want to configure our product. Scroll down through the New Products page, and click on the Create Configurations button. In the grid, select the Size attribute and click on Next.
- Select the sizes for your products and click on Next.
- On the next screen, you can add images, prices, and quantities for the products, or you can do this later.
- When you click on Next, you will get an overview. When you click on Generate Products, the products will be displayed as shown in the following screenshot:
- Click on the Save button and a popup will show up to create a specific attribute set for this configuration. Select the Add configurable attributes to the new set based on current option and select a Size for the name.
- Click on Confirm to save the products in the database.
- On the Product Edit page, select the category where you want to add the product, click on Save, and search for the product in the right category in the frontend. The product detail page will look as follows:
How it works…
A configurable product is a product where you can select one or more options on the product detail page. Each combination of selections leads to a simple product in the database. The customer chooses the options, and when adding the configurable product to the cart, a simple product is also added in the background.
This is the reason why we have generated simple products to be shown as options in our configurable product. The configurable product is a parent wrapper that is used to display in the frontend. The simple products are hidden in the frontend by the Visibility
attribute.
When a product is sold, the SKU of the selected child product will be used to process the order. That's the reason why we have to configure a stock on the child products.
There's more…
In Magento, we can create six types of product. The following overview gives a short description of what is possible with the different product types.
A simple product
A simple product is just a product that you can sell in your web shop. Every product in Magento has a unique ID (SKU) that mostly has the same value as the article code of the suppliers.
A configurable product
In this recipe, we created a configurable product. This product has child products that you can configure on the product page (for example, to configure the size). The child products are simple products.
A bundle product
A bundled product is like a configurable product, but with this one, you can (optionally) specify more options.
In the sample data, you can find a good example by navigating to Gear | Fitness Equipment | Sprite Yoga Companion Kit.
Note
Every option of a bundle represents another product in the shop. When you add a bundle product to the cart, the products of the chosen configuration will also be added to the cart in the background.
A grouped product
A grouped product is a product that represents a set in which you can specify the number of child products. A good example of this can be found by navigating to Gear | Fitness Equipment | Set of Sprite Yoga Straps.
In a grouped product, you assign simple products. When adding a grouped product to the cart, the child products will be added as separate products with the configured quantity.
A virtual product
A virtual product is like a simple product but it is not physical. It has no inventory and can't be shipped. A good example of a virtual product is a software license.
A downloadable product
A downloadable product is a product that is not physical. When a customer buys a downloadable product, a download link will be sent to the customer so that they can download their product, which is in the form of a PDF, MP3, ZIP file, or any other type of file.