1

I need to use events 2 places

1 - When customer verified email

 <event name="controller_action_predispatch_customer_account_confirm">
        <observer name="insert_customer_info_cova" instance="Company\Namespace\Observer\InsertCustomerInfo"/>
    </event>

2 - When customer edit address information

<event name="customer_address_save_after">
        <observer name="update_customer_address_cova" instance="Company\Namespace\Observer\UpdateCustomerAddress" />
    </event>

It is working fine when customer registration page have no address fields but when we are showing address fields on registration page then this event is fire "customer_address_save_after"

So I need to block that "customer_address_save_after" event when customer register on registration page

Anyone know how to block that event ?

2

You can check referUrl and set condition according that

use below code to check referUrl

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();

$refeUrl = $objectManager->create('Magento\Framework\App\Response\RedirectInterface')->getRefererUrl();

You should not use the ObjectManager directly!

2
  • ok checking,yes may be it works – sumeet bajaj Jul 4 '20 at 12:50
  • i did it other way upvote for your answer – sumeet bajaj Jul 20 '20 at 8:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.