Questions tagged [event-observer]

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

607 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
17 votes
4 answers
2k 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 ...
Scruffy Paws's user avatar
7 votes
1 answer
850 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 ...
Yaroslav Rogoza's user avatar
6 votes
1 answer
856 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 = $...
Ravi Varma's user avatar
5 votes
1 answer
824 views

Any Observer or plugin event for specific module disable?

I want to perform some action when my custom module gets disable. Is there any observer event or plugin event that being fired when i disable my module? Any help would be appreciated. Thank you,
Jackson Wyss's user avatar
5 votes
1 answer
450 views

How to assign cart data in order Magento 2?

I am successfully save custom data in cart using checkout_cart_product_add_after event in "quote_item_option" table Now i want to save this data in order and display in order section in admin panel.
Sanjay Gohil's user avatar
  • 2,190
5 votes
2 answers
570 views

Magento 2.1 - On reindex start event

I am looking for an observer event that is triggered when any re-index starts. I want to create an observer that sends out an email whenever an index has been initiated for re-indexing.
Peter A's user avatar
  • 71
5 votes
1 answer
1k views

Render Javascript on customer_login event

I'm trying to render some javascript when the customer_login event fires by accessing a block on the layout from within the observer. I've successfully registered my observer to execute with the ...
r3v's user avatar
  • 51
5 votes
2 answers
5k views

Remove and recreate custom option programatically on product before save event

I m creating a custom option programmatically using observer with the catalog_product_save_before event.The custom option was created successfully on product save. but the problem is whenever the ...
Zaheerabbas's user avatar
  • 2,068
4 votes
1 answer
314 views

Issues with the `sales_order_item_cancel` event in Magento 2.4.1

I have made an API which cancel and order. This is part of the code: // \Magento\Sales\Api\OrderManagementInterface $this->orderManagement->cancel($order->getId()); The above code will ...
Attila Naghi's user avatar
  • 3,903
4 votes
3 answers
2k views

Magento 2: What is the best way to observe cart change to modify cart item in magento 2?

I'm using Magento v2.3.4 and i want to modify the cart item, if there is an update on the cart (add to cart, update cart item, and remove cart item). Currently I'm using plugin for quote collectTotals(...
jojo's user avatar
  • 149
4 votes
0 answers
462 views

Magento 2 - Order status update observer

I am looking for order status update observer In many post I have found this one: sales_order_save_after But, it is not working, I have checked it myself. It is not even listed in these articles: ...
Waqar Ansari's user avatar
4 votes
1 answer
571 views

Change quote currency before place order

I want to change my quote currency code to EUR when an order is placed in any other currency. I tried writing event and observer of event sales_order_place_before. In my observer I have this code ...
Bharath N's user avatar
4 votes
1 answer
1k 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: ...
VIPIN A ROY's user avatar
4 votes
0 answers
958 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 ...
apedic's user avatar
  • 923
4 votes
1 answer
1k views

Programatically set product attribute defaults - Magento 2

My specific use case is that I want to set the news_from_date and news_to_date for the a thirty day period from when the product is created. I would like this to work so when a user goes into the ...
BVBAccelerate's user avatar
4 votes
1 answer
2k views

Adding custom column into product grid

I have created a custom column for associated products (basically every simple product will have that column under "associated products" tab of configurable product). I store information of this field/...
Capri82's user avatar
  • 213
4 votes
1 answer
2k views

Tracking Ajax Add to Cart Event

I have a problem I've been struggling for a couple of days and I would really like you to point me in the right direction. I am developing a module to track basic stuff like addToCart and ViewContent ...
user38930's user avatar
3 votes
0 answers
168 views

Magento 2 getFullActionName() not working when FPC is enabled

I have an observer subscribed to controller_front_send_response_before event. in the observer i'm trying to call the page type by getFullActionName() method. But when the magento FPC is enabled, its ...
Amjad M's user avatar
  • 31
3 votes
0 answers
561 views

Magento 2 set custom variable to use in email template on all emails

I want to be able to add a custom variable through an event observer of some sort which enables me to output this variable in any given email template. I know I can make an event observer for example ...
ElFietsbel's user avatar
3 votes
0 answers
115 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 ...
MageLerner's user avatar
3 votes
1 answer
909 views

Sign up (guest checkout) issue in Magento 2

I have added customer_register_succes event for guest customer account creation during guest checkout. After the successful order when the user sign up by my event and observers call in which I load ...
summu's user avatar
  • 837
3 votes
1 answer
74 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 ...
dirac's user avatar
  • 45
3 votes
0 answers
280 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 ...
Haim's user avatar
  • 2,114
3 votes
0 answers
425 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 ...
sky's user avatar
  • 1,397
3 votes
1 answer
663 views

Rogue "enterprise_refresh_index" causing excessive Merchandising failures

Thanks in advance for reading, and for any help you can hopefully offer. My company uses Magento for our marketplace, and while we've always had occasional issues with AOE Scheduler unable to kick ...
Art's user avatar
  • 41
3 votes
0 answers
372 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 ...
Rizwan Khan's user avatar
  • 1,939
3 votes
1 answer
2k views

Newsletter subscription at the checkout review

Expected functionality: user checks the "Subscribe" checkbox in the OnePage Checkout's review step and is subscribed to the newsletter. So far I have managed to target the right event (after ...
Domas's user avatar
  • 115
3 votes
1 answer
4k 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 ...
ssnegi's user avatar
  • 37
3 votes
0 answers
363 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 ,...
amith lal's user avatar
  • 766
3 votes
0 answers
2k 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\...
Jackson's user avatar
  • 9,849
3 votes
1 answer
310 views

Mage_Log visitor observer not triggered

my problem is that viewed products are not working for guest users. After some hours of research I found out that the VisitorId is not generated. Then I found out that Mage_Log is responsible for this....
Morgy's user avatar
  • 101
3 votes
1 answer
3k views

Magento event after filling checkout shipping address

Which magento event gets triggered after filling shipping address on checkout one page as I need to pass some information to a third party api just after shipping address.
Arun Pal's user avatar
  • 523
3 votes
2 answers
1k views

How to create observer to change order status after it was created?

I am creating a custom payment method. Before calling the payment gateway, I am calling PlaceOrderAction javascript function in mypay-method.js. that way, order is created in Processing status. ...
jstuardo's user avatar
  • 609
3 votes
0 answers
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> <...
Vinaya Maheshwari's user avatar
3 votes
3 answers
236 views

Disallow adding products if sku or shipping type exists in cart

As the title says. I need to be able to disable adding to cart if a product sku or shipping type already exists in the cart. Any way this can be done? Created checkout_stop.xml in app/etc/modules ...
MHeredia's user avatar
3 votes
1 answer
5k views

Magento 2: After login how to get current quote id?

Magento 2: After Customer Login Get Cart Information? On observer I got 2 active quote id's. I can get by latest from quote table. Is there any way to get current quote id?
Jackson's user avatar
  • 9,849
2 votes
3 answers
184 views

Prevent invoice email notification after invoice creation in Magento 2

I have used below event to stop Invoice email notification that is triggered after the invoice creation. Vendor/Module/etc/events.xml <?xml version="1.0"?> <config xmlns:xsi="...
Jafar Pinjar's user avatar
  • 1,929
2 votes
0 answers
167 views

Source code is empty in shipment observer magento2

I am trying to get source_code from the shipment_id Have used below event. Vendor/Module/etc/events.xml <event name="sales_order_shipment_save_after"> <observer name="...
Manjunath's user avatar
  • 177
2 votes
2 answers
442 views

Magento 2 : Get shipping method using observer

I am trying to get the the shipping method using observer but I cant seem to get it to work, this is what I have for the ShippingTypeEmail.php <?php namespace vendor\Emails\Observer; use Magento\...
miller75's user avatar
  • 409
2 votes
0 answers
106 views

Magento 2: event or plugin after filters applied and removed in category pages

I want to write customization on after filters are applied and filters are removed in category pages. I need any event or plugin while filter applied or filter removed in Magento 2.3.2.
Jothi Subramanian's user avatar
2 votes
1 answer
259 views

What is the difference between getStoredData and getData?

I'm adding some custom logic in the admin when the customer is saved. I've created an observer on the customer_save_before event. I am using the following code to get the customer: /** @var \Magento\...
Radu's user avatar
  • 460
2 votes
1 answer
205 views

Need to redirect to given controller

I need to redirect to ('hello/Test/Customer') page but observer is not working. <?php namespace SimpleMagento\Custom\Observer; use Magento\Framework\Event\Observer; use Magento\Framework\Event\...
Akash Killedar's user avatar
2 votes
0 answers
477 views

Magento 2: Set Product final price using catalog_product_get_final_price Event

Using event catalog_product_get_final_price, setting the maximum price to be 100, if the price of a product is greater than 100 then it will set automatically to 100 and the product price is below 100 ...
irshad's user avatar
  • 171
2 votes
0 answers
96 views

Magento2 - update to custom status after shipment creation

I created an Observer that makes some execution based on the company needs using event sales_order_shipment_save_after. It does everything I need except changing the order status to a specific. I ...
Gustavo Ulyssea's user avatar
2 votes
0 answers
682 views

Magento 2.3.1 Change store view in controller_action_predispatch event

In my extension, the default storeview is English and I want to set Arabic storeview, only one time when the customer comes first time on my website. I'm using controller_action_predispatch event to ...
Dhara Bhatti's user avatar
2 votes
1 answer
405 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 ...
Khushbu's user avatar
  • 825
2 votes
1 answer
2k views

Magento 2 checkout_cart_product_add_after not working

here am trying to add custom price during adding product to cart but checkout_cart_product_add_after event is not getting fired. my API to add to cart is http://localhost/magento/rest/V1/carts/636/...
Praveen Negimani's user avatar
2 votes
0 answers
54 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) ...
Wakar Ahamad's user avatar
2 votes
0 answers
27 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 "...
sv3n's user avatar
  • 11.6k
2 votes
0 answers
32 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="...
Rakesh Chand's user avatar

1
2 3 4 5
13