Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [event-observer]

Event/observer is used to work dynamically with Magento without altering the core code.

10
votes
0answers
257 views

Is there an event or plugin spot for when cart rule is no longer valid?

Is there an event or place I can plugin for when a shopping cart price rule is no longer valid (such as when it expires or if you change the quantity of other products where it no longer applies)? I ...
8
votes
0answers
265 views

Magento 2: Observer add product to cart?

I've read some other post about adding products to cart, but nothing seems to fit. I've an observer for checkout_cart_update_items_before that adds another product in same qty if specific product is ...
5
votes
0answers
329 views

Magento2 : How to set custom meta title & meta description by observer?

I want to set meta title , description by the help of observer. But unable to set data here. please see my code: $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $_page_config = $...
5
votes
0answers
437 views

_origData is null for some models in Magento 2 before or after save

Let's get a customer save process from the admin panel as an example. We have an event observer for model_save_before and trying to get a set of values for the model that have been changed upon the ...
3
votes
0answers
23 views

Save value of custom field in minicart to order Magento 2

I have added one field "Special instructions" (textarea) in mini cart which I want to get saved in order details when customer put the order. In which observer can I get the value of this field? and ...
3
votes
0answers
22 views

Background or concurrent taks in Controllers

I am currently programming an extension for Magento 2. I am developing an observer that is triggered when you make an action inside a controller in the admin section. What I do is to fetch all ...
3
votes
0answers
198 views

Magento2 Product add form custom form values not posting in observer

I am Creating custom product add form in magento2.2.2. I have added a new tab after product details & Loaded My custom phtml File into It, First To Post Data from product form to observer, i ...
3
votes
0answers
186 views

Prevent place order using observer in magento 2

Hi I'm trying to prevent placing order with the help of observer i have already trigger the event "sales_order_place_before" with this i got all the details of the order like products in cart ,...
3
votes
0answers
767 views

Magento 2: Same Event with Multiple Observer in Different Module causes redirection issue

Magento 2: Same Event with Multiple Observer in Different Module causes redirection issue To solve: Magento 2: Can we call one observer in another observer? I have followed below code magento\app\...
3
votes
0answers
1k views

Create Event observer which fire when customer create while create order in magento admin

I have create a SMS module which send sms to customer when a new customer create. My config.xml is below : ... <!-- Event for customer register success from frontend --> <global> <...
2
votes
0answers
58 views
+50

Observer for Abandonment of Cart

I need help!!! I am creating a module that integrates with another platform via API. I already got the Observer or Event for customer registration (customer_register_success), purchase completed (...
2
votes
0answers
11 views

Using Split Orders Extension but order confirmation mail is shooting for first order only instead of all

I'm using "order split" extension based on seller,means if there are 6 items in the cart having 3 different seller(have 2 item for each seller) then three orders(let's says order id as 500,501,502) ...
2
votes
0answers
17 views

Set product attribute “comment” from backend

No time for coding actually, so I just want to ask if maybe someone already has a working solution (w/o rewrites) :) I just want to add a text input field to "edit product attribute" page, that show "...
2
votes
0answers
25 views

Apply product offer when subtotal grater or equal 1000 only for specific date

I want to add new product offer when cart subtotal >= 1000 This offer valid only for every month between day 1 to 7 (1-m-yyyy to 7-m-yyyy). Therefore i used below event - <event name="...
2
votes
0answers
21 views

Magento 2 : Which event will trigger when a Navbar Item is clicked?

I've done some searching around and i'm trying to find the observed event for when a particular navbar item is clicked. The goal is to run some code for whenever that navbar item is selected but I do ...
2
votes
0answers
70 views

Cart observer unit testing

I created a module that has some logic to modify the price of certain items depending on a few conditions pertaining to the other items in the cart. I'm trying to write a unit test to test that the ...
2
votes
0answers
153 views

What is the event observer for system config page load in Magento 2

We know that we can use custom_admin_system_config_changed_section_general for system config page save event. But is there any observer to the config page load event? Thanks.
2
votes
0answers
534 views

Magento-2 : How to set product custom price after add to cart

I have used checkout_cart_product_add_after event, for change product price. Used observer code like below $item->setCustomPrice($price); $item->setOriginalCustomPrice($price); $item->...
2
votes
0answers
315 views

How can I change grand total when user Clicks on Custom Payment method?

I am using the one-page checkout module. I want to change the grand total when user/customer selects the payment method. If customer/user selects the online payment option then grand total should ...
2
votes
0answers
296 views

Issue in 'catalog_block_product_list_collection' observer event

I need to filter my front end product collection to list product according to a custom attribute value. But the product listing page is not filtering according to my condition. The code used are: ...
2
votes
0answers
379 views

magento2 prepend item into menu tree object (Topmenu)

So I've already hooked the "page_block_html_topmenu_gethtml_before" event with the observer class, I can add items to the menu tree, and it works fine, but I can't prepend items to the menu tree ...
2
votes
0answers
26 views

Redirecting admin user before creating an order in adminpanel issue M1

I have a custom condition for customers . If that condition is satisfied I would like make a redirect with a message that 'the order cannot be created'. I used the sales_order_place_before event to ...
2
votes
0answers
323 views

Magento 2 Enterprise edition, get all custom attributes of product in the observer

My store has many GroupProduct and each one has many virtual products. This virtual products have custom attributes and some are required and some aren't. [MyModule]/Setup/InstallData.php $eavSetup-&...
2
votes
0answers
430 views

Detect Inventory change on Magento2 triggered by API

I'm working on a module for keeping track of inventory changes on orders, admin variation, api calls. I'm using the event cataloginventory_stock_item_save_after which works fine on 2.2 but it seems ...
2
votes
0answers
116 views

Add customer email to order via observer make export csv error

Here is my observer to add the code to show email in order grid public function coreBlockAbstractToHtmlBefore(Varien_Event_Observer $observer) { /** @var $block Mage_Core_Block_Abstract */ $...
2
votes
0answers
288 views

Change redirect url based on store id

I create an observer for controller_action_predispatch in frontend to redirect site to particular store url like this: public function execute( \Magento\Framework\Event\Observer $observer ...
2
votes
0answers
2k views

Getting error message: Some transactions have not been committed or rolled back

This is my code. I am trying to create a credit memo in an observer: $OldOrder = Mage::getModel('sales/order')->loadByIncrementId(12132332); $invoicesAll = []; $invoices = ...
2
votes
0answers
73 views

Observing a generic event, but ignoring most instances

Is it bad practice to listen for a common event, but then to filter out all but a tiny number of those events? As an example, say I want to modify a particular block. I can listen for the ...
2
votes
0answers
798 views

How to set custom final price on product page or product listing page?

In Magento 1.9, I have used the event catalog_product_get_final_price to set a custom final price for the product page. However in Magento 2 the price is not changing when using the same event.
2
votes
0answers
1k views

magento cron trigger shutdown

I am writing custom cron to send a mail in every two minutes.I am also using it with AOE Scheduler extension. Code: /var/www/magento2/app/code/local/Produpdates/Notify/etc/config.xml <?xml ...
2
votes
0answers
267 views

Observing REST API requests from 3rd party

I would like to know if there are any API events that are fired when a third party API sends a request to Magento? For example, if a 3rd party makes a call to salesOrderShipmentCreate() method app/...
2
votes
0answers
129 views

Magento Enterprise url rewrite in observer

We tried to implement this scenario in ee 1.13: we have a custom product attribute (new_edition_id), when a product is saved, if this attribute is set, we want to create a url rewrite from current ...
1
vote
0answers
15 views

checkout_cart_product_add_after fired only once for grouped product

I m observeing checkout_cart_product_add_after event to modify quote item. But it seems it fired only once no matter how many qty or item i have added from detail page. My goal is to change each ...
1
vote
0answers
20 views

How to debug checkout_cart_product_add_after event on exit

I am trying to exit point on observer for checkout_cart_product_add_after event. But it always refresh after item added to cart. Any way to print data when debug this event and not refresh the page. ...
1
vote
0answers
36 views

Magento 2 - Recently viewed product not working with FPC

Magento default functionality of recently viewed product uses the following event to save viewed history catalog_controller_product_view And it stores in following tables ...
1
vote
0answers
31 views

Check stock at cart validation

I need to call a webservice to ckeck the stock of products in my cart. I added this observer: MyModule/etc/events.xml <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/...
1
vote
0answers
26 views

How to refresh minicart section from observer?

I am moving cart items to wishlist when store is switched using below code: etc/frontnend/events.xml <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:...
1
vote
0answers
93 views

Magento 2 - Event after customer edit Account Information

I need to add some custom logic in my extension after Editing Account Information, It should not trigger at Change Password or Edit Address. Will customer_account_edited work. $this->...
1
vote
0answers
61 views

Magento 2 Send Admin Customer Registration Email

I'm trying to set up an observer that sends an email to the admin when a user registers on the website. I am following a tutorial but have hit a dead end. The observer is working correctly however I ...
1
vote
0answers
10 views

Magento 2 : Getting issue during added non-visible product to cart through observer?

For this, I use below event observer <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:...
1
vote
0answers
34 views

How to set Billingaddress during sales_order_place_before programmatically

I need all orders to have the same billing address (its because the store is used company internal) but the shipping address may vary. My thought was to set the Billing Address programmatically during ...
1
vote
0answers
44 views

Add additional shipping fee using observer when customer after chose the shipping method

I'm tyring to add a additional cost to a shipping price after customer picked a shipping option (custom made shipping method), the event is base on checkout_controller_onepage_save_shipping_method, ...
1
vote
0answers
27 views

Magento 2 Modal Pop up from exception

I have an observer that rejects this save of orders conditionally and throws a message. Instead of the message I would like to trigger a modal. How can I get this done? $message = “We were unable to ...
1
vote
0answers
88 views

Magento 2 | Can't reset customer password and change name

I am listening to following event with an observer: customer_address_save_after The problem: Whenever the customer wants to reset the password or change his name or email address this observer is ...
1
vote
0answers
83 views

Magento event “sales_order_creditmemo_save_after” taking long time to set the data

I have created a custom module and used event sales_order_creditmemo_save_after, here is my event code: <sales_order_creditmemo_save_after> <observers> <...
1
vote
0answers
86 views

Magento 2 Event sales_order_payment_pay not triggering

I've to call a form after payment successful(before order success page) for Magento 2.2.4. (User will just fill this form & we'll just save corresponding to order-id). So I'm using "...
1
vote
0answers
70 views

Magento 2: create a coupon code using events and observers

I need to create a coupon code for different customers based on their country. For example: If the customer is from US, the discount should be 10% and if it is UK, it should be 20%. This I have to ...
1
vote
0answers
294 views

Magento 2 sales_order_save_after doesn´t trigger when edit order in admin

I had configure a observer to listen the event sales_order_save_after when the order changes its status. In Vendor/Module/etc/events.xml <?xml version="1.0"?> <config xmlns:xsi="http://www....
1
vote
0answers
106 views

Checkout Submit Event Observer, huge delays while loading

I am trying to use an Event Observer to run some code after the user checks out. This is what i have so far: <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-...
1
vote
0answers
92 views

Magento2 customer register event for rest call

I am sending sms on customer registration using customer_register_success, fired in app/code/Magento/Customer/Controller/Account/CreatePost.php But as this is from controller, and not fired when ...