Stack Exchange Network

Stack Exchange network consists of 174 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.

0
votes
0answers
7 views

E-mail copy with changed subject line

How can I send a copy of each mail to the retailer and include the order number or customer number in the subject? Is there an event that covers all mails?
0
votes
0answers
8 views

Magento 2 Second time loading not going to observer controller_action_predispatch with cms_page_view

I have created a observer controller_action_predispatch and did an echo its triggering on all page view but with Second time loading its not triggering on cms_page_view for all other pages it ...
0
votes
1answer
28 views

Magento 2: Get Order Info From Invoice

Using Magento 2.3, I'm trying to get a custom attribute from the order and save it to the invoice when the invoice is first created. I already have the custom attributes setup and saving to the ...
0
votes
0answers
11 views

How to check “Save & continue” button is pressed in observer Magento 2?

how can I get redirect back url in observer? I have created one module which has one observer which fire on "catalog_product_save_commit_after". after product save I have some custom functionality ...
0
votes
0answers
8 views

interesting m1 problem with config / update toggles

we have a tricky problem that i'd like to throw out to the community. essentially we want to be able to IP restrict traffic using a toggle (so we can test a feature before releasing to the public) ...
2
votes
2answers
45 views

How to get a form value in order process?

I have created a new small module to add a checkbox on last step of order process: The value will transfer over payment JSON: In the generated PaymentExtensionInterface I have the getter and setter ...
0
votes
1answer
15 views

magento 2 how to create a store and store view in customer_save_after_data_object observer?

create the observer sucessfully the add the create store code but there is an error "Something went wrong while saving the customer." the code is given below- namespace Namespace\Modulename\...
0
votes
0answers
12 views

Magento 2.2.2 - Restrict access to Admin and redirect to 404 if unautohrized

I need to allow specific IP's/IP range as authorized users to access Magento admin area and redirect to 404 page not found if an unauthorized IP try to access http://store.com/admin. Could think of ...
0
votes
1answer
24 views

Observer after product is added to cart

what is the name of the event that I can trigger after adding a product to the cart ? I need this : The customer adds a product to his cart Intercept the event thanks to the result of and API, add ...
0
votes
0answers
9 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 programatically during ...
0
votes
0answers
17 views

Magento 2: Get Payment Information in checkout_submit_all_after event observer

I have need to get Payment information in checkout_submit_all_after event observer. File path: magento/app/code/Vendor/Module/etc/events/xml <event name="checkout_submit_all_after"> <...
1
vote
2answers
23 views

Order placed event

I use sales_order_save_commit_after for same change to shipment and after this i save new subtotal and grand total, it's worked very well for COD but when i wanna use to another online payment the ...
0
votes
1answer
25 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 ...
0
votes
1answer
21 views

how to trigger observer by rest api

I need to trigger observer whenever I call specific rest api I've created module/Observer/ObserverClass, module/etc/events.xml and module/etc/webapi-rest/events.xml but I don't know How to trigger it ...
0
votes
0answers
9 views

controller_action_predispatch is not observing after logout

I am performing a logout function if user is not approved. So I created observer controller_action_predispatch which will trigger in all pages so that it will check the approval if not it will logout ...
0
votes
0answers
21 views

Magento 2 I want to get order increment id and update all item of sales_order_item table order wise in below observer. How can i do that

I want to get order increment id and update all item of sales_order_item table order wise in below observer. How can i do that namespace Namespace\Moduename\Observer; use Magento\Framework\Event\...
3
votes
2answers
53 views

How to trigger an observer programatically with it's required data from a custom controller file in Magento 2?

I have create event controller_action_predispatch_checkout_cart_add as given below: Vendor/Module/etc/frontend/events.xml <?xml version="1.0" encoding="UTF-8"?> <config xmlns:xsi="http://...
0
votes
1answer
26 views

Magento 2 How can i add BCC to order email with observer programatically?

I have created module and wrote one an observer on "order_place_after", here i want to send the same order email copy to my custom email address. How can i send the same order email to my custom ...
1
vote
1answer
16 views

How to get the shipping address from using sales_order_payment_save_after event

I need to save the shipping address while order is placed in my custom table how to i take the shipping address . I am using the event sales_order_payment_save_after and did the following codes $...
0
votes
2answers
51 views

Magento 2 How to add custom attribute to customer address and how to insert value in that attribute?

I want to add a new custom attribute to "customer_address" that I did with an attribute installer script, now I am able to see that field in "eav_attribute" table. I have created a module and I have ...
0
votes
1answer
16 views

Magento 2 How to get custom field name 'location_id' aded to “customer_address_entity” at frontend, on order place after observer?

I have create one module which add 'location_id' in 'customer_address_entity' table. I also create one observer which called when order placed. Here i got the address id from order, Now i want to ...
0
votes
1answer
32 views

Magento 2.3 - event when catalog price rules are applied

I am working in a module which extends catalogrule feature In this module, we apply some changes to price calculation process. Right now, it is working when a product is saved in admin. We have ...
1
vote
1answer
33 views

How can I capture save/update/delete events of custom extension?

I have one custom extension installed, and I want to capture its save/update/delete action events and I am not sure how can I capture those events. Please help. I have successfully able to capture ...
0
votes
0answers
27 views

How Can I Output Message From Template Method?

Let me prefix this by saying I am brand new to Magento. I am a Laravel developer helping a co-worker out. I am on Magento 1.14.1. I'm trying to output something on a page and I'm not sure where it's ...
0
votes
2answers
53 views

How to get Cart Id and Subtotal in sales_order_save_after observer?

I have to call some API on order status complete. For that I need values for the following. credit card number (16 digits). CVV subtotal and I have already called an API while place order I need to ...
0
votes
0answers
16 views

Modifying Order Status on sales_order_status_history_save_before event

I'm trying to automatically update certain orders to complete_1 after complete_0 is triggered. The status is updating ins status history but not on the actual order. if ($commentStatus == '...
0
votes
1answer
12 views

Magento 2 - what event should I observe to change/intercept the calculation of subtotals on Cart

I am using Magento 2. I made an observer that observes anytime a new item is added to the cart. The observer works properly, I also managed to create a single product discount with this observer, ...
0
votes
1answer
44 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(); $...
0
votes
0answers
36 views

what is the same event “checkout_controller_onepage_save_shipping_method” of magento 1 in magento 2? [duplicate]

I created a events.xml for my custom module, the following code <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:...
0
votes
1answer
33 views

How to generate Order invoice by capturing “sales_order_save_after” event | Magento 2

This is events.xml <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd"> <...
0
votes
2answers
49 views

How to print order details for event observer sales_order_save_after

want to print order details and product details (variants) which are ordered. My xml file <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:...
0
votes
1answer
38 views

How to know “sales_order_place_after” event is captured in Magento 2?

I have done this so for: app\code\Vendor\Extension\etc\events.xml <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:...
0
votes
1answer
26 views

Magento 2: Unable to get item_id while event “sales_order_save_after” is trigger

I need the product item id while sales_order_save_after event call. I try the following code. I am not able to get the item_id $order = $observer->getEvent()->getOrder(); foreach($order->...
0
votes
1answer
33 views

Magento 2 : set custom price in product when add to cart

I see some answers about set custom price in product when add to cart. But, I can't still solve my issue. I used observer for that to set custom price. But, it's not working. Can anyone please help ...
1
vote
1answer
37 views

Magento 2: How to stop event/observer if another already ran

I have 2 events running if subscribe to newsletter is checked on the checkout page. sales_model_service_quote_submit_success newsletter_subscriber_save_after Can i prevent event #2 from happening if ...
0
votes
0answers
26 views

Get order id and product id while order placed using Observer | Magento 2

Hi i need to get the order id and product id while order is generated in magento2 <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:...
1
vote
0answers
27 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, ...
0
votes
1answer
100 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" ...
0
votes
0answers
13 views

Magento 2 Custom JS Component detect/Observe changes from any form input in the DOM

I have ny Component as so: define(['uiComponent', 'jquery', 'ko', 'jquery/ui', 'mage/translate', 'Magento_Ui/js/modal/modal', '...
0
votes
0answers
31 views

Custom field value is not getting in observer in Magento 2

I have created a custom field in advance inventory in magento 2 product edit but its value is not getting in observer my code is like <fieldset name="stock_data"> <container ...
0
votes
0answers
22 views

When is modify the prices in quote_address_item?

I need to change prices of product when users use multi-shipping. So I create an observer to the event "checkout_type_multishipping_set_shipping_items" and I fixe prices at 0€ in quote_address_item" ...
1
vote
1answer
48 views

How to enable a shipping method for a specific SKU?

I'd like to create a module to enable the Table Rate Shipping Method if a product with a specific SKU is the customer cart. How could I do that?
0
votes
1answer
29 views

Not able to get post data from observer : M2

i want to get form data from checkout page in 2nd step, so i have use event observer. I have use this controller_action_predispatch_checkout event. I want to get post data so i have try this link ...
3
votes
1answer
144 views

Observer for invoice creation after it is saved

I have tried the following events for invoice creation observer: sales_order_invoice_save_after sales_order_invoice_pay sales_order_invoice_register ...
2
votes
2answers
184 views

How to get order event after placing order using observer in admin side?

i want to get the order event and want to use the order object data , tried this but something is missing, here is what i tried and how can i use this data in my helper/block class or controller ...
0
votes
0answers
13 views

How to manage order status/state in observer?

I have a custom shipping method. I am doing some tasks in one event-observer when the order is placed. I need to change the order status (maybe also the order state) if my tasks have failed. It is, ...
0
votes
0answers
29 views

before place order checkout stock by remote api

We are using Magento2.2.6 and we need to update stock when remote ERP also call remote ERP API when placing an order, Currently we are using Magento2's observer pattern and update stock when user ...
0
votes
2answers
28 views

Magento 2: Can't get item ids on sales_order_save_after event

I need something to do using order item ids when order is created. I tried sales_order_place_after and sales_order_save_after events, but unfortunately. Items from $observer->getEvent()->...
1
vote
1answer
93 views

Product edit form issue in admin panel magento2

Here is my etc/adminhtml/events.xml <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events....
1
vote
1answer
21 views

How can I get full cart contents from Customer Login observer (Magento 2)

I have created an observer for customer_login event which requests the current cart contents. I have tried to use (as indicated in other posts in this forum): public function __construct( ... ...