In this blog post, we will see how to add our own product type in Magento 2. There are 6 types of products in Magento 2 namely Simple product, Grouped product, Bundle product, Configurable product, virtual product, and Downloadable product.
But in some cases, everyone is not satisfied with these products so you can create a new Magento 2 product type follow the given below steps. Let’s Create It.
Steps to Create a New Product Type in Magento 2.
Step 1: Create ‘product_types.xml’ file in location Webiators/CustomProductType/etc.
1 2 3 4 5 |
<?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Catalog:etc/product_types.xsd"> <type name="demo" label="Demo Product" modelInstance="Webiators\CustomProductType\Model\Product\NewProductType" indexPriority="70" sortOrder="70"> </type> </config> |
Step 2: Create NewProductType.php file in location
Webiators\CustomProductType\Model\Product\Type\NewProductType
1 2 3 4 5 6 7 8 9 |
<?php namespace Webiators\CustomProductType\Model\Product\Type; class NewProductType extends \Magento\Catalog\Model\Product\Type\AbstractType { public function deleteTypeSpecificData(\Magento\Catalog\Model\Product $product) { } } |
After completing the above steps, you will see a new product type in the admin.
If you have any doubts about this topic please mention them in the comment section below.
Thank you.