We can create and add new product type in magento2.
In this blog we will see how to add own product type in magento2.
New Product Type Declaration
First of all create ‘product_types.xml’ file in location Namespace/Module/etc.
<?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="Namespace\Module\Model\Product\DemoType" indexPriority="70" sortOrder="70"> </type> </config>
After defining product type in ‘product_types.xml’, we need to create model for product type.
Finally create DemoType.php in location Namespace/Module/Model/Product.
<?php namespace Namespace\Module\Model\Product; class DemoType extends \Magento\Catalog\Model\Product\Type\AbstractType { public function deleteTypeSpecificData(\Magento\Catalog\Model\Product $product) { } }
After this you will see a new product type in admin.
Be the first to comment.