[Magento 2] Update product attribute programmatically

It’s pretty easy when you have the eavSetup in your setup module. It’s only necessary to execute: $eavSetup->updateAttribute(Product::ENTITY, $attributeCode, $attributeField, $value); For example, if I want to change the ‘position’ field value of the ‘price’ product attribute: $eavSetup->updateAttribute(‘catalog_product’, ‘price’, ‘position’, 100);

[Forms] Remove a field from a Form

Recently I wanted to remove a field from a form object. It was easy, we need to know 2 things: Fieldset name (‘main’ by default) Field name With this information we can just update the form object with: <?php $this->getForm()->removeField(‘password_fieldset’); ?>