Jump to content


Photo

How to Add Product Attribute Programmatically in Magento 2

magento 2 add product attribute InstallData.php install() Method terminal/SSH New Product Attribute

  • Please log in to reply
No replies to this topic

#1 alex288

alex288

    Member

  • Members
  • PipPip
  • 25 posts

Posted 14 October 2020 - 10:38 AM

magento-2-add-product-attribute-programm

 

 

Basic steps to programmatically add product attribute in Magento 2

 

1: Create the Setup File InstallData.php

 

File Path: app/code/Company/Mymodule/Setup/InstallData.php

 

 

2: Describe the install() Method

 

<?php

public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)

{

}

 

 

3: Develop Product Attribute

 

4: Upgrade

 

 

Get more details about these steps by clicking on the link below:

 

How to Add Product Attribute Programmatically in Magento 2



looking for the best presta addons with outstanding support? check this: PrestaShop Modules




Also tagged with one or more of these keywords: magento 2, add product attribute, InstallData.php, install() Method, terminal/SSH, New Product Attribute