When I created one Customer Custom Attribute and changed its value website-wise from Admin-> Edit Customer Information so did not change it.
<?php
namespace VendorExtensionSetupPatchData;
use MagentoEavSetupEavSetup;
use MagentoEavSetupEavSetupFactory;
use MagentoFrameworkSetupModuleDataSetupInterface;
use MagentoFrameworkSetupPatchDataPatchInterface;
use MagentoCustomerModelCustomer;
use MagentoCatalogModelResourceModelEavAttribute;
use MagentoCustomerSetupCustomerSetupFactory;
class AddCustomerStatusAttribute implements DataPatchInterface
{
private $moduleDataSetup;
private $customerSetupFactory;
public function __construct(
ModuleDataSetupInterface $moduleDataSetup,
CustomerSetupFactory $customerSetupFactory
) {
$this->moduleDataSetup = $moduleDataSetup;
$this->customerSetupFactory = $customerSetupFactory;
}
public function apply()
{
/** @var EavSetup $eavSetup */
$customerSetup = $this->customerSetupFactory->create(['setup' => $this->moduleDataSetup]);
$customerSetup->addAttribute(
Customer::ENTITY,
'customer_status',
[
'label' => 'Customer Approve',
'input' => 'select',
'required' => false,
'sort_order' => 40,
'visible' => true,
'system' => false,
'is_used_in_grid' => true,
'is_visible_in_grid' => true,
'is_filterable_in_grid' => true,
'is_searchable_in_grid' => false,
'type' => 'int',
'default' => 1,
'source' => 'MagentoEavModelEntityAttributeSourceBoolean',
"note" => "Set Approve to login"
]
);
$attribute = $customerSetup->getEavConfig()->getAttribute('customer', 'customer_status');
$used_in_forms[]="adminhtml_customer";
$attribute->setData('used_in_forms', $used_in_forms)
->setData("is_visible", 1)
->setData("sort_order", 100);
$attribute->save();
}
/**
* {@inheritdoc}
*/
public static function getDependencies()
{
return [];
}
/**
* {@inheritdoc}
*/
public function getAliases()
{
return [];
}
}