Questions tagged [event-observer]

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

Filter by
Sorted by
Tagged with
0
votes
1answer
27 views

Magento 2 how to check if customer changes his password?

I'm using an observer that triggers every time customer edit it's account. I'm using customer_address_save_before for some reason this event also triggers when I modify my email, name, or password ...
1
vote
1answer
25 views

Error message not displaying in Observer Magento2

I used below event, <event name="catalog_controller_product_view"> <observer name="custom_product_view_layout" instance="Vendor\Module\Observer\CheckProduct" /> </event> Then ...
0
votes
1answer
16 views

Magento 2 how to lock a customer account when it's in an specific group?

I have been searching how to lock a customer account but had no luck. My idea is to create a customer group called Locked, and every customer that is assigned to that group will be locked. I was ...
1
vote
2answers
2k views

Onchange event in while country change in magento 2

I need to change city field as a select field while change country name as India. otherwise, it shows text field. I follow this link use @Idham Choudry answer, but its throw Uncaught TypeError: ...
0
votes
2answers
19 views

Magento 2 : Event when customer in backend is created and updated

I want to know how to solve this problem: I need to trigger an observer when a customer is created and one different when customer is updated. I was using customer_save_before event which works ...
0
votes
2answers
24 views

Observer not triggered for customer_register_success event

I've read through countless posts with similar issues and have made sure I didn't have the same errors. I'm trying to use the customer_register_success event to trigger an observer that will fetch an ...
1
vote
1answer
44 views

How can I observe the “special price” activation? When the special price becomes active

How can I observe when a Special price becomes enabled? You set a date from and to, but which observer is launched when special price becomes available and unavailable?
3
votes
2answers
1k views

Redirect customer login/register success to checkout Magento 2.2

I am creating a module for redirect login/register success to checkout if customer has some items on quote but that's not working. If I stop the event with that die; on Observer/Redirect.php above ...
3
votes
1answer
43 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 ...
2
votes
1answer
126 views

Magento 2: How to get product old and new data on product save button in admin backend?

I am working on Admin Actions Log Extension. For the reference, I am using the link below https://amasty.com/admin-actions-log-for-magento-2.html I want to get old and new data of products while we ...
0
votes
0answers
11 views

Event for apply discount coupon Magento 2

I want to add custom validation for Discount coupon that it can be used only on first order of any customer. For this i want to create an observer for an event which will trigger when customer ...
1
vote
0answers
348 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....
2
votes
2answers
921 views

How to alert in sales_order_save_after observer?

I am triggering sales_order_save_after event after order status has been completed. public function execute(Observer $observer) { $order = $observer->getEvent()->getOrder(); $...
1
vote
2answers
611 views

how to update customer and order details from magento to ERP using event observer?

I need to update the customers data from magento to ERP. whenever customer going to check out the order,it ask for Guest or Register and checkout. when we select the Register and check out option,it ...
0
votes
1answer
12 views

Magento 2 how to get customer data in Observer in customer_account_edited event?

I'm trying to get customer Id, first name, last name , email and Address info after customer_account_edited event is triggered, but I'm getting error 500 and the error is Uncaught Error: Call to a ...
2
votes
1answer
2k views

Get selected Custom Options from configurable product

the following observer script looks for selected configurable options, to work out the qty needed and adds a simple product (#9236) to the cart. However, it only works for simple products. How can I ...
1
vote
1answer
47 views

Magento 2 cookie not set when full cache enable

I have created one helper file that get, set and delete cookie. This helper file I called in observer to set cookie. The helper file called but cookie not set when full cache enabled. <?php ...
0
votes
0answers
22 views

Magento 2: Get names of all people who ordered the product

Our client would like to have names of all people who ordered a product included into the Out of Stock notification email. I seem to have issue with getting such info ... Code I have to get the ...
2
votes
1answer
2k views

How to get quote item id in checkout_cart_product_add_after observer in magento2

I have setting the custom price of the product on adding to cart which I am doing through some observer . Everything is working fine except I am not getting the item id in the observer.I tried ...
5
votes
2answers
4k views

what is the event in magento 2 when store configuration save?

what is the event that is triggered after the save config action is performed in magento 2 Stores - Configuration, and how to write a simple observer method after the save is done.
1
vote
4answers
60 views

Magento 1.9 : What event used before order placed and get shipping information for the order [closed]

For my condition how to get the shipping methods before order placed My Observer : https://gist.github.com/ZusZus/66da0a7aaeb0db53eff38d8bb89ae941
0
votes
2answers
619 views

Cart items will not be deleted in observer

I searched a lot but none of the solutions worked for me, I am trying to delete an Item from observer but if there is only one item in cart it works with removeAllItems() but if there are more than ...
0
votes
1answer
27 views

Magento 1.9: get data from text area in observer using event?

I need get data from text area in which customer write comment, than that comment I need add to order using sales_order_place_before event and save order to sales_flat_order. Customer comment must add ...
0
votes
2answers
45 views

Magento 1.9: Print variable value in Mage::Log

My observer : public function checkproductinorder($Observer) { $order = $Observer->getEvent()->getOrder(); $items = $order->getAllItems(); foreach ($items as $...
0
votes
2answers
317 views

Magento 2 controller_action_predispatch observer not working as expected

I have created a Observer controller_action_predispatch which triggers in all page. Some thing happens strange with this When I clear all cache and login for the first time the observer triggers in ...
1
vote
2answers
562 views

Magento 2 Observer not called due to caching?

Intention I am trying to get an affiliate extension to work. The basic concept is that a customer calls the shop-page with a get parameter that is the id of the affiliate partner. The ID will be ...
0
votes
2answers
1k views

Add to Cart Resulting in: Cannot add the item to shopping cart

I have this observer listening: sales_quote_product_add_after Inside the observer I run this code to change the price of the item when added to the cart. $item = $items[0]; $request = Mage::...
2
votes
3answers
4k views

How to get quote Id using sales_quote_collect_totals_after events

I have create a programmatically order. But when submit order sales_quote_collect_totals_after events fire before save collect totals. Here is my code : $storeId = Mage::app()->getStore()->...
0
votes
1answer
630 views

Is there any event for after clicking proceed to check out?

I want to check additional checking with the product that has already been added in the cart, is there any method of event observers for doing this, our intention is to find out the customer who has ...
1
vote
0answers
240 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 ...
0
votes
0answers
14 views

magento 2 event for out of stock

I would like to know when a product goes out of stock by user purchase. I think there should be an event for this. I am not able to find it though. Also, in general, has Magento 2 published the ...
27
votes
4answers
3k views

Returning $this after observer

I see some conflicting information on the internet and in 3rd party modules alike - is it a requirement or best practice to return $this at the end of an observer method? E.g.: ...
1
vote
1answer
1k views

Customer save after event magento2

I have used this event "customer_save_after_data_object" used this code in events.xml file <event name="customer_save_after_data_object"> <observer name="customer_save_after_observer" ...
1
vote
1answer
663 views

Adding a custom checkbox in sales orders admin grid

I want to add a checkbox on admin grid in sales order page. I want to have in between "New order Rss" and "export menu". Having a hard time figuring out how to do this as I am quite new to Magento. ...
0
votes
2answers
37 views

Magento 1.9.X: Add customer comment to order using observer

How can I add customer comment from checkout page using observer? Customer comment is introduced from the block with a text area. When I create new order I need to add a comment to this order using ...
0
votes
1answer
48 views

Update Product prices after adding to cart

I am trying to update product prices after adding to cart but the change on prices don't apply on it. I have created an event on checkout_cart_product_add_after while on observer I have written code ...
0
votes
0answers
8 views

Magento 2: Get Raw POST data whenever /shipping-information API is hit

I am using a headless magento 2 for my store, and am having some data consistency problems with shipping addresses. To troubleshoot this, I was thinking about saving the POST body whenever these API ...
0
votes
2answers
2k views

How to get updated cart subtotal in checkout_cart_product_add_after event observer in Magento 2?

I want to add a free product to cart with another product. For that I wrote checkout_cart_product_add_after event observer. My problem is, I don't get the updated cart subtotal(after adding first ...
0
votes
1answer
28 views

Magento 1.9 : How can i filter specific state inside foreach with Observer

How can I add if the condition for my for each loop, my_observer : <?php class Gta_GetOrderDetails_Model_Observer { public function getdetailsafterorder($Observer) { ...
0
votes
2answers
67 views

Magento 2 how to get Postcode from billing address in observer?

I cannot get the postcode from Users's billing Address,this is my code, everything works fine except for the postcode, which i'm not able to pull. $objectManager = \Magento\Framework\App\...
0
votes
0answers
36 views

Magento 2 : Stock Inventory Save After Observer - Issue

This observer triggered only when Quantity is out of stock or when we save the Quantity. Is there any other Observer event in Magento when the Quantity get Change while creating an order from the ...
0
votes
1answer
50 views

Magento 1.9 - How to Override/Rewrite Third party Module?

I am using this extension for Extra Fees, I did some override/rewritein this file in magento (app/code/local/Voronoy/ExtraFee/Model/Quote/Address/Total/Fee/Rule.php). FYI -> The override/rewrite ...
0
votes
1answer
48 views

Magento2 : Product not saving set custom attribute using Observer

I want to set Discount on my product after Save product so I'm using catalog_product_save_after then I am creating an attribute 'discount' and set the calculated value, but when i save the collection ...
0
votes
0answers
8 views

I need to change customer group when user logs in via specific link

I need to link already registered user to the customer group. I'm trying to solve it using event and observer. User will receive a link and logging in using the present link, the customer will be ...
0
votes
2answers
27 views

Magento 2.3: How to get tracking info from an order in observer

We use ShipStation to send tracking information to Magento and I'm trying to retrieve the order shipping / tracking information once this is saved to the order. If I use ...
1
vote
1answer
927 views

Saving a product in an observed product save event

I've noticed in a couple community extensions we have installed that they observe the event catalog_product_save_after, and in the triggered method they will get the product and do something to it (...
0
votes
1answer
626 views

Magento 2 : Set free shipping method programatically from an observer

I need to add free shipping method fro particular quote in an observer. I am calling an event sales_quote_collect_totals_before. And my observer code is - namespace Vendor\Module\Observer; use ...
0
votes
1answer
24 views

what is the use of _merge_before and _merge_after event in Magento 2

I want to know the difference between following Magento 2 events 1)sales_quote_add_item 2)_merge_before 3) _merge_after and how I can use the event in event.xml sales_quote_add_item and ...
1
vote
2answers
2k views

How to get price for configurable product

I have configurable products like I created observer and I got the price Default price is for 1kg but customer can change the weight and flavor. When customer changes weight and flavor price ...
0
votes
1answer
41 views

Add to cart before Magento 1 - Cancel adding

I am creating an observer to cancel the addition to the cart with add_to_cart_before. Here is my config.xml Module_Stockespagne_Model ...