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
0answers
6 views

Magento 2 FPC invalidate homepage, specific product page and specific category cache in observer

I need to create on observer that should invalidate cache of the homepage, a specific product page and a specific category cache when a trigger occurs. Anyone can help ? Thanks !
0
votes
0answers
12 views

How to go to checkout review section and throw an error in Magento 2?

In my checkout_type_onepage_save_order observer, i have a code to do some validation and it will make the customer go to the checkout review and throw some error, in Magento 1.9 i can do it like this: ...
0
votes
0answers
6 views

Update available Payment Method list

I have created a custom module using this tutorial that applies a set of rules for available payment methods, based on shipping method selected and shipping address. <?xml version="1.0"?> <...
0
votes
0answers
14 views

How to get custom field value in observer from checkout custom form

hey there here i am trying to save the values my custom checkout form's values in db tables . Here is my custom form. i have used event observer to save values and hard coded values are getting ...
0
votes
0answers
15 views

Magento2 Observer For Coupon Post Not Working

Created one observer for coupon post in events.xml <event name="controller_action_predispatch_checkout_cart_couponPost"> <observer name="checkout_cart_coupon" instance="Vendor/...
0
votes
1answer
15 views

Function call to Gift message capturing, no message entered by the customer: how to handle simple scenario?

Good Evening: The event being used here is sales_order_place_after. I want to collect message our customer enter when placing the order. It is noticeable that this event doesn't handle when customer ...
0
votes
1answer
11 views

Magento 2 salesrule obsersver save after & before

In Magento 1.9 i have an observer salesrule_rule_save_before and salesrule_rule_save_after for the backend area, are there any equivalent observer like this in Magento 2 ?
0
votes
1answer
28 views

Magento 2 equivalent event of checkout_onepage_controller_success_action

I am working In Magento 2 Module, I've to do some customization on Magento Onepage checkout, for that I plan to use the checkout_onepage_controller_success_action, but In my project, We're installed ...
0
votes
1answer
29 views

Which Plugin or Observer will work perfect at the time of Saving Order data in sales_order table Magento 2.3.4?

I am trying to know that which plugin or observer will work perfectly while saving order data in sales_order table. Actually i am trying to debug a scenario where only for one order, Grand Total &...
1
vote
2answers
52 views

Custom Observer not triggering

I have been trying to resolve this issue for 2 days but cannot seem to find the issue why the observers won't trigger. I hope some good soul out there might spot the issue and help me out on this on. ...
0
votes
0answers
12 views

Sort Menu items in aphabetical order magento 2 in observer

I am creating menu items in magento 2. I is working fine and generated according to category order in admin dashboard. But I wanted to sort the menu items alphabetically on store front ir-respective ...
0
votes
1answer
28 views

Magento 2.3 How to add customer login function for my existing Observer?

Following are the code show Premium or Non-Premium along with product name using observer, <?php namespace Gta\CustomerMsgPdp\Observer\Product; use Magento\Framework\Event\Observer; use Magento\...
0
votes
0answers
25 views

Customer validation called twice (Observable event re-execution)

I'm customizing customer_account_create. I need save taxvat as CPF/CNPJ (Brazilian attributes) so I need to validate it, then I created an observable in: etc/events.xml <?xml version="1.0"?> &...
0
votes
0answers
15 views

Add a JS event to input field Customer Registry page

I'm unable to associate my Input with javascript. I need to add an event to my input when user type something. My input field: <div name="field-fullname" class="field required"> <label ...
0
votes
0answers
24 views

Magento2 - Get X product and Y product at some discount?

Suppose a scenario I defined for a Cart Price Rule buy X product and get Y Product at some discount , suppose customer added X product to cart how can we notify him about Y product, I have used the ...
0
votes
1answer
27 views

Magento2 - How to get cart sale-rules information with respect to specific Product?

I am using event checkout_cart_add_product_complete which is triggered after Doing Add to cart any product, in the observer of this event I want to get associated cart price rule if any applied?
0
votes
1answer
36 views

Magento2 - Call to the empty Gift message object causes the observer class to fail

I'm trying to edit an associative array containing order info. This array for our backend application gets created under sales_order_place_after event once the order is placed .Everything works as ...
0
votes
0answers
207 views

Sending order create email when order is updated to certain status

I have created an custom email template which Mageplaza smtp sends when order is placed but I need it to be send went certain order status is set and so I have created an event which triggers on "...
1
vote
0answers
17 views

Define an event on select with event observer

My template is located in src/app/design/frontend/MySite/default/Magento_Checkout/templates/cart/item/default.phtml There is a select and in this select I'm adding an event. <select id="cart-<?...
0
votes
0answers
19 views

Magento2 - Error on checkout page while adding Configurable product to cart

I am using a custom module, where I want to redirect to checkout page once a product is adding to cart. For this I have created an observer controller_action_postdispatch_checkout_cart_index. For ...
1
vote
2answers
50 views

How to get customer from observer in Magento 2?

I need to send data to an external API when a customer (I mean a logged in customer) add a product to wishlist. I found the event: wishlist_add_product. $this->_eventManager->dispatch( '...
1
vote
1answer
28 views

Magento 2 get customer info after customer save event

I created a custom module that call a remote API service. I have to call this API on some events, like: customer create, customer edit, order create etc... For customer edit all works fine with: ...
0
votes
1answer
33 views

How to Go To previous Url with an Error from Observer in Magento 2

I am working on Magento 2 Extension i am trying to implement an event customer_save_before What i want to do is.. if user email is from a domain like abc.com it should go to Previous URL with an ...
0
votes
0answers
65 views

Magento 2: Rest API “Checkout Cart Product Add After” event is not working

I have faced issue in checkout_cart_product_add_after event using add to cart rest API. Same add to cart event is working in website. But it is not working in Add to cart rest API. Add to cart API ...
1
vote
0answers
17 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\...
0
votes
1answer
42 views

Magento 1.9 - How to post data from predispatch event to controller action

I want to change the data that is processed in the checkout_onepage_saveBilling controller action. I am using an observer with the predispatch event to catch the POST data which is coming from the ...
0
votes
0answers
18 views

How to write an observer with verification of existing id

I have bundle products on which I display selects with some data <?php /* @var $block \Magento\Bundle\Block\Catalog\Product\View\Type\Bundle\Option\Select */ ?> <?php $_option = $block->...
0
votes
0answers
11 views

Magento 2 - changing store view from observer

I have an observer in my module (fired on controller_action_predispatch) which checks the current logged in customer billing country, and sets the store view accordingly. For example: $this->...
0
votes
0answers
24 views

How to observe event before saveShipping or saveBilling actions for address validation

Update: For my understanding (please correct me If I am wrong) the problem here is that the controller_action_predispatch_checkout_onepage_saveBilling gets dispatched and the following code is being ...
0
votes
1answer
30 views

Order items is empty when customer logged-in

I'm use following code to catch order information in this Observer : "sales_order_save_after" public function execute(\Magento\Framework\Event\Observer $observer){ $orderData = $observer->...
0
votes
1answer
34 views

sales_order_save_after event not fired when creating an invoice

I like the event to be fired when we create an invoice for an order, to get order status complete etc/adminhtml/events.xml <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:...
1
vote
5answers
176 views

Magento 1.9 - Anyone help me What is error in my Observer?

My Custom observer : app\etc\modules\Gta_FindPaymentGateway.xml <?xml version="1.0" encoding="UTF-8"?> <config> <modules> <Gta_FindPaymentGateway> <...
0
votes
0answers
7 views

checkout_submit_all_after is not fired when creating an invoice

I like to get the event when the order is changed to Complete, i tried checkout_submit_all_after event and sales_order_save_after but when i tried to create an invoice (to get completed order status) ...
0
votes
0answers
18 views

Limit Quantity For the Products With Specific Attribute Magento2

Trying to Limit all the products with having a specific attribute (Yes/No) and others will behave normal. I have used the event in my module my event.xml <event name="...
1
vote
2answers
36 views

Magento 2 - Observer after order not work

In Magento 2, I try to add an observer sales_order_place_after and it doesn't work. app/code/Vendor/Module/etc/event.xml <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/...
0
votes
0answers
29 views

Magento 2 Custom Module - Load Subscriber Email in PHTML file after newsletter subscription

I am working on a custom module where we need to load the email address of a newsletter subscriber in a phtml file after they subscribe. Our Observer file is triggered on a subscription event and ...
0
votes
0answers
27 views

Programmatically stop a catalog search after it's been started in Magento 2.3.3

I'm using an observer on the event "controller_action_postdispatch_catalogsearch_result_index" to redirect the user to a landing page if their search query matches one of a number of specific phrases ...
0
votes
0answers
17 views

Magento 2 customer_register_success Event not getting triggered

Here am trying to trigger a Event on Customer Registration. but Observer is not getting triggered. Where am doing wrong. Can i get Help? Thank you in advance. This is the events.xml /app/code/...
1
vote
1answer
33 views

Magento 2 delete event get product skus using observer

I need to perform a operation when a product is deleted from admin. So I have created a observer using below code which is working fine. Vendor/Module/etc/adminhtml/events.xml <?xml version="1.0"?...
0
votes
0answers
36 views

Magento 1.9 Observer - PHP 7 mail function how to set multiple recipient mail id based on condition?

Following code for sending multiple recipient mail based on first digit of sku from order received, <?php class Gta_MerchantNotification_Model_Observer { public function merchantremainder($...
1
vote
1answer
20 views

Update Product Qty while product is being added to cart

I want to update qty to 2 when product is added to Cart. Basically I want that when a user ads a product to cart(qty is not visible for user), it is set to qty by default. I have created an observer ...
0
votes
1answer
34 views

Where is sales_model_service_quote_submit_before dispatched?

Where in the source does the event sales_model_service_quote_submit_before dispatch in Magento 2?
0
votes
1answer
26 views

How to store custom attribute after place order?

I am trying to store customer's reward point into sales_order table using event-observer. here is my events.xml <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-...
0
votes
2answers
68 views

How to send Observer Response via mail?

My observer : <?php class Gta_MerchantNotification_Model_Observer { public function merchantremainder($Observer) { $order = $Observer->getEvent()->...
1
vote
0answers
23 views

Magento 2 get order qty items is null

I'm trying to get the total weight of the items in checkout_submit_all_after With this code: $orderItems = $order->getAllItems(); $weight = 0.0; $length = 0.0; $width =...
0
votes
1answer
29 views

I want to enable free shipping

I want to enable free shipping if some condition satisfies(programmatically). Which event should I use and how should my observer look like..? Kindly guide.
0
votes
0answers
10 views

Magento2: How to use product inventory(qty) in salesRules conditions

I want to apply the SalesRules based on product Qty on cart using event Observer. What is the best way to use this. I am using below events:- checkout_cart_product_add_after ...
0
votes
1answer
25 views

Magento 2 get dimensions of products in order event

I'm trying to get the dimensions(length,width and height) and weight of all products in an order. The event that I'm using is checkout_submit_all_after. In observer I have this code. $order = $...
0
votes
1answer
42 views

Get newsletter subscribed on customer save

I am trying to get the value of 'if newsletter subscribed' on customer save. I am using the event: customer_save_after_data_object for customer update and tried to get the subscription value by this ...
0
votes
1answer
21 views

Magento 2 order is shipped twice on sales_order_save_commit_after event

I'm trying to ship an order automatically everytime an order is placed, just with event sales_order_save_commit_after works, I tried sales_order_place_after and it throws me the error of "No such ...

1
2 3 4 5
38