While creating set of product attributes via program, it gets assigned to existing Product Sets as well as to newly created Product Sets. I don't want to assign those created attribute to any Attribute Set.
Can anyone help me to solve this issue.
Solved! Go to Solution.
After creation, remove the attribute group from the Default attribute set, which you do not want to add in new attribute set. Because new sets gets created based on Default Attribute Set.
Hi Prema,
Pass 'user_defined' => true to stop assigning attribute to any attribute set.
$eavSetup->addAttribute(
\Magento\Catalog\Model\Product::ENTITY,
$finalAttributeID,
[
'type' => $type,
'backend' => '',
'frontend' => '',
'label' => $attName,
'input' => 'text',
'class' => '',
'source' => '',
'global' => \Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface:COPE_STORE,
'visible' => true,
'required' => false,
'user_defined' => true,
'default' => '',
'searchable' => false,
'filterable' => false,
'comparable' => false,
'visible_on_front' => false,
'used_in_product_listing' => true,
'unique' => false
]
);
Hope it helps!
Hi Prema,
Pass 'user_defined' => true to stop assigning attribute to any attribute set.
$eavSetup->addAttribute(
\Magento\Catalog\Model\Product::ENTITY,
$finalAttributeID,
[
'type' => $type,
'backend' => '',
'frontend' => '',
'label' => $attName,
'input' => 'text',
'class' => '',
'source' => '',
'global' => \Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface:COPE_STORE,
'visible' => true,
'required' => false,
'user_defined' => true,
'default' => '',
'searchable' => false,
'filterable' => false,
'comparable' => false,
'visible_on_front' => false,
'used_in_product_listing' => true,
'unique' => false
]
);
Hope it helps!