I am trying to create a custom attribute and add it to a custom created attribute set. The problem is that it is being added to the Default attribute set. How can I make it only appear in my attribute set? Below is the code I am using in the upgrade script.
/* @var Magento\Eav\Setup\EavSetup $eavSetup */
$eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);
if (version_compare($context->getVersion(), '1.0.2', '<')) {
$data = array (
'type' => 'string',
'label' => 'Designer',
'input' => 'text',
'required' => false,
'sort_order' => 3,
'global' => ScopedAttributeInterface::SCOPE_GLOBAL,
'group' => 'Product Details',
'used_in_product_listing' => true,
'visible_on_front' => true,
);
$attributeSet = 'Test-Attribute-Set';
$entityTypeId = $this->coreRegistry->registry('entityType');
$eavSetup->addAttribute(
\Magento\Catalog\Model\Product::ENTITY,
'designer',
$data
);
$eavSetup->addAttributeToSet(
$entityTypeId,
$attributeSet,
'Product Details',
'designer'
);
}