We sacrifice by not doing any other technology, so that you get the best of Magento.

We sacrifice by not doing any other technology, so that you get the best of Magento.

If you need to assign your custom attribute in all attribute set programmatically then you can used below steps:

$objectManager = MagentoFrameworkAppObjectManager::getInstance();
 
$attributeCode = 'is_featured';
$attributeGroup = 'General';
 
$eavSetup = $objectManager->create(MagentoEavSetupEavSetup::class);
$config = $objectManager->get(MagentoCatalogModelConfig::class);
$attributeManagement = $objectManager->get(MagentoEavApiAttributeManagementInterface::class);
 
$entityTypeId = $eavSetup->getEntityTypeId(MagentoCatalogModelProduct::ENTITY);
$attributeSetIds = $eavSetup->getAllAttributeSetIds($entityTypeId);
foreach ($attributeSetIds as $attributeSetId) {
 if ($attributeSetId) {
 $group_id = $config->getAttributeGroupId($attributeSetId, $attributeGroup);
 if(empty($group_id)){ continue; }
 $attributeManagement->assign(
 'catalog_product',
 $attributeSetId,
 $group_id,
 $attributeCode,
 100
 );
 }
}

Here, we performed the task using objectManager. But You can perform it via module.

field_5bfb909c5ccae

    Recent Articles
    Get a Free Quote

      Full Name

      Email Address

      Mobile Number

      Message

      Let’s initiate a discussion!!

      With Only Agency that provides a 24/7 emergency support.

        Full Name

        Email Address

        Mobile Number

        Message