I am trying to update the “customer_entity” table “custom_column” value upon customer confirmation. For that I used a plugin as follow.
This is my di.xml content for this pluging
<type name="MagentoCustomerModelAccountManagement">
<plugin name="customCustomerEntityColumn" type="VendorModulePluginModelAccountManagementPlugin"></plugin>
</type>
And this is my Plugin class and method :
<?php
namespace VendorModulePluginModel;
use MagentoCustomerApiCustomerRepositoryInterface;
class AccountManagementPlugin
{
public function __construct(
protected CustomerRepositoryInterface $customerRepository
){}
public function afterActivate($subject, $result, $email, $confirmationKey)
{
$customer = $this->customerRepository->get($email);
$customer->setData('is_confirmed', 1);
$this->customerRepository->save($customer);
return $result;
}
}
but the “custom_column” value is not updating.
Note: I added this column to “customer_entity” table using db_schema.xml file with default value “0”. Now I wanted to update the value as 1 upon customer confirmation.
I struggling a lot for this but could not be able to save the value.
What is wrong with my script or my working flow, can you please help me in this to sort out ?