I am tring to create a new product but I do not get the price enabled on the admin panel.

I create a product_types.xml with this structure:

<?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="my_product" label="My Product" modelInstance="My\Module\Model\Product\Type\MyProduct" composite="false" isQty="true" canUseQtyDecimals="false" indexPriority="30" sortOrder="20">
            <attribute name="is_real_product" value="false"/>
            <attribute name="refundable" value="true"/>

Then I create the model as My\Module\Model\Product\Type\MyProduct like this:


namespace My\Module\Model\Product\Type;

use \Magento\Catalog\Model\Product\Type\Virtual;

class MyProduct extends Virtual
     * Product type code
    const TYPE_CODE = 'my_product';

When I try to create a new product in the admin panel I do not get the option to input a price. What Am I missing? By the way I have tested this model with AbstractType and Simple Product too.


Ok, I found what was missing. You need to set price and other attributes to any new prodcut_type. You add so by adding this to your InstallData.php file:

  if (version_compare($version, '0.0.3', '<')) {
        $eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);

        $fieldList = [

        // make these attributes applicable to downloadable products
        foreach ($fieldList as $field) {
            $applyTo = explode(
                $eavSetup->getAttribute(\Magento\Catalog\Model\Product::ENTITY, $field, 'apply_to')
            if (!in_array('my_product', $applyTo)) {
                $applyTo[] = 'my_product';
                    implode(',', $applyTo)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.