Happy to see you guys again!

In this Magento 2 Tutorial, we will learn how to Add a new product type in Magento 2 step by step using one real extension. As you know, Magento 2 store comes with six different product types.

  • Simple product
  • Configurable product
  • Grouped product
  • Bundle product
  • Downloadable product
  • Virtual products

These are all product types available in Magento Community out of the box. In this blog post we will learn how to create custom product type in Magento 2 using extension. We will create “Digital Product” type with this blog post step by step.

Lets consider module with Namespace is Magewallet and Module Name is DigitalProduct. Lets list down all the files require for this extension.

1)app/code/Magewallet/DigitalProduct/registration.php
2)app/code/Magewallet/DigitalProduct/composer.json
3)app/code/Magewallet/DigitalProduct/etc/module.xml
4)app/code/Magewallet/DigitalProduct/etc/product_types.xml
5)app/code/Magewallet/DigitalProduct/Setup/InstallData.php
6)app/code/Magewallet/DigitalProduct/Model/Product/Type/Digital.php
7)app/code/Magewallet/DigitalProduct/Model/Product/Type/Digital/Price.php

First we will create registration file at app/code/Magewallet/DigitalProduct/registration.php file

Now, create a composer.json file in app/code/Magewallet/DigitalProduct/ folder as per below.

now create module.xml file in app/code/Magewallet/DigitalProduct/etc

now create product_types.xml file in app/code/Magewallet/DigitalProduct/etc

Create a setup file in app/code/Magewallet/DigitalProduct/Setup/InstallData.php

Create Model file app/code/Magewallet/DigitalProduct/Model/Product/Type/Digital.php

Create Price Model file app/code/Magewallet/DigitalProduct/Model/Product/Type/Digital.php

Thats it.

Active Magewallet_DigitalProduct extension

Open Command line in folder root of Magento and run commands

Now you can check new product type at backend panel by adding new product. You will get more ideas from this screenshots.

Select New Product Type Magento 2

Select New Product Type Magento 2

Digital Product in Grid

Digital Product in Grid

Add New Digital Product

Add New Digital Product

If you have any questions about this Magento 2 Tutorial, please ask them in comments.
Enjoy Magento 2! Enjoy Magewallet!!

Mahendra Paladiya
Mahendra is a Web Developer whose passions includes web development, technical blog writing, and database management. His passion for web development pushed him into learning how to handle different platforms like Core PHP, Magento, Prestashop, WordPress, CodeIgniter, CakePHP and Oracle.