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.

3
votes
2answers
32 views

How to check observer called from search page?

I am accessing observer (controller_action_layout_render_before) through this: app/code/Vendor/Module/etc/events.xml <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/...
0
votes
1answer
22 views

Magento2 Event after Default Billing address change, How to send email if Billing address change?

I want to send an email to admin if the default billing address selection is changed or the values are changed by the customer. How can I achieve this?
1
vote
1answer
33 views

How to get recently viewed product collection in observer Magento 2

I want to fetch a recently viewed products collection in the observer and by using that collection I want to add my custom product in that collection. Following Things That I Want To Achieve. On ...
6
votes
1answer
116 views

Save and display ui_component's custom field

I've added custom text box to source form using below code. <field name="delivery_time" formElement="input" sortOrder="70"> <settings> <dataType>text</...
1
vote
0answers
35 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
16 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:...
0
votes
1answer
23 views

Magento2 : IncrementId value not resulting in an order

I want to load the data of an order with the incremental id after placing an order. I am getting the incremental id in the data array after placing an order, but cant load any orders with it. My ...
0
votes
1answer
47 views

How to set a custom price of a product when adding to cart using an observer in Magento 2?

I want to set a custom price of the product when adding to cart using an observer. For that, I added this code but it's not working app\code\Webkul\Hello\Observer\CustomPrice.php <?php /** ...
0
votes
1answer
26 views

Button add to cart stays on adding… after i setParam('product', false)

I have a checkout_cart_product_add_after event that calls to a observer file in which i want to check a condition. If that condition is false i block the product from adding to the cart and want to ...
2
votes
2answers
25 views

Issue with an observer

I created an observer to update the product, but it is not entering it. config.xml: <cataloginventory_stock_item_save_after> <observers> <gestaobox_api> &...
1
vote
3answers
35 views

Get productinfo from Observer controller_action_predispatch_checkout_cart_add

In Magento 2: I have created the event observer: <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:...
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 "...
1
vote
1answer
39 views

Magento 2 - Get Invoice data using observer

I am trying to know if create shipment option is selected from admin while creating invoice from admin by creating an observer. I have tried sales_order_invoice_register ...
3
votes
1answer
43 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,
2
votes
1answer
27 views

Magento 2: Checkout afterplace order plugin not working

Im creating a Magento 2 checkout plugin, I want to fetch the orderdata and send it to a third party for order handling. I have made a plugin for the Magento\Sales\Api\OrderManagementInterface class, ...
0
votes
2answers
40 views

Magento 2 checkout observer debugging

I'm trying to create a Module that gets the order data when an order is placed and sends it to a third party using FTP. I've created an Observer that gets called by the sales_order_place_after event. ...
0
votes
0answers
24 views

Magento 2 Observe Button in another module

I was wondering if it were possible to execute some code from within another module when a button is clicked from within the current module? Is there some way of attaching an observed event on to the ...
1
vote
0answers
13 views

Catalog page loads at the middle of the screen when using pagination - M 2.1.15

When I go to page 2 or 3 it takes me to the lower middle half of the page instead of the top of the next page. Is there a way to make it go to the top of the next page instead?
4
votes
1answer
59 views

Automatically send invoice email after order has been paid in Magento 2.2.3

I am trying to trigger the customer invoice mail after an order has been paid and the invoice has been created. The payment gateways are PayPal Plus (iways) and Amazon Pay. If I understood correctly, ...
2
votes
1answer
23 views

Observer for import products

I want to create an observer to execute when the import product is executing, i need persist product informations in another table when the export action is in process, i try the following: ...
1
vote
1answer
35 views

Disable sort/filter for existing grid column

Is it possible to disable filterable/sortable for an existing grid column via observer or layout update?
2
votes
2answers
25 views

Magento 2 - disable sale for product by plugin or event

The product has attribute "is_special_action". I need to disbale product for sale if this attribute equals 1. I suspect we can use CustomModule\Plugin\Catalog\Model\Product.php class, add this ...
3
votes
1answer
24 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 ...
3
votes
1answer
38 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.
3
votes
0answers
18 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 ...
1
vote
1answer
29 views

Event for before invoice creation magento 2

Do we have any event for invoice before create? When we click on invoice and about to submit the form , do we have any event there? Want to do some modification before creating invoice.
1
vote
2answers
41 views

Magento 2 : How to convert class object to string using observer?

I am getting error during to save order data to xml format using observer.. Recoverable Error: Object of class Magento\Sales\Model\Order\Item\Interceptor could not be converted to string in ...
1
vote
1answer
28 views

Doubt about observer in magento 1.9

I have a lot of observers that work like that: <controller_action_postdispatch_checkoutopt_index_pagamento> <observers> <auto_invoice_order> <type>...
2
votes
1answer
31 views

Can't change customers groupId in observer

I try to change the customers group id in the observer sales_order_place_after but it seems to be impossible. I successfully managed to change the firstname of the customer just for test, but groupId ?...
1
vote
1answer
22 views

Get total in observer sales_order_place_before

I try to get the total value (price of his order) of the customer in the sales_order_place_before event. How can I read the total value? This is a part of my observer, it is getting called, I only ...
2
votes
0answers
21 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="...
0
votes
1answer
61 views

Create event and observer for customer sign up (Magento 2)

How can I create my own event and observer for customer sign up, From this link, Magento2 : customer_account_create event is not triggering I found that We can use customer_register_success for ...
1
vote
0answers
20 views

Observer for the event controller_action_predispatch not working for default Magento2 REST APIs

I have created an observer for the event controller_action_predispatch. The observer is working only for the front end and backend request but not for default REST APIs. I have place the event.xml ...
2
votes
1answer
53 views

Magento 2 - Sales Order Shipment Event/Observer

I search on the Internet for sales order shipment event. In many Stack Exchange question I found this event sales_order_shipment_save_after. In most of Question they are saying it is not working and ...
1
vote
0answers
18 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 ...
1
vote
1answer
32 views

Detect change in system.xml field with observer

I need to config a observer to detect when a option created in system.xml change its value. The field is made by the code above: <config> <sections> <dev> &...
0
votes
1answer
24 views

How to break a event flow form an Observer and redirect to the same page in Magento 2?

How can I break a flow when some condition is true? Let's say the customer is writing a review for the product https://url/review/product/post/id/2/ and when the user presses the save butto some ...
1
vote
1answer
13 views

How to retrieve data from an event review_controller_product_init_before inside the observer in Magento 2?

Using Magento 2, I trying to retrieve the data (rating, nickname, ...) when the user write a review for a product. i want to retrieve this data, do some process and return back to be displayed in the ...
1
vote
3answers
47 views

hiding products for guest user M2

I have one question about showing products. I dont want to show products for guest user. Even when they search for those products they will not get that. Only logged in user will get those. Can ...
0
votes
2answers
51 views

redirect to the product url from observer or controller magento 2

i want to redirect from observer to the default magento product url from observer. public function __construct( \Magento\Framework\App\ResponseFactory $responseFactory ) { ...
0
votes
1answer
30 views

How can we check context object list for observer in magento2

I want to know context object list which we can use methods directly from $context object in Observer. Just like in below URl. Magento2 – Use Defined Methods from Context Object URL:- https://webkul....
2
votes
1answer
69 views

how to add a free product in Cart automatically when any other product added in cart in Magento 2

Add a free item in the cart. For example when anyone adds X product in the cart then Y automatic added if remove X then Y automatic remove. for doing this task I made an observer and an events.xml ...
0
votes
0answers
11 views

Prevent applying shopping cart rule for specific customer

Is it possible to prevent appliying shopping cart price rule for the specifc customer using event observer?
0
votes
1answer
109 views

How to call helper function observer in magento2

I am trying to call helper function on observer custom module in Magento2 but Unable to call helper in observer. Please help me if anybody have this solution. I am waiting for all your positive ...
0
votes
1answer
33 views

Adding custom layout handle for layouts (1 column, 2column etc) set via product admin page

I want separate layout handles defined for products dependent on their layout set via the layout options for product within admin (1 column, 2 column left, 2 column right). I need to set additional ...
2
votes
1answer
28 views

How can I update shipping method by using observer and event “sales_quote_collect_totals_before” magento 2?

I want to apply functionality for the customer if customer place order within 72 hrs and subtotal greater than 250 then I want to give free shipping method otherwise if above 72 hrs or subtotal is ...
0
votes
0answers
37 views

Event trigger before loading page (for add product to cart)

What's the name of the event that is trigger to display the product in the minicart and in the checkout/cart page ? I want to do this : Add some free product programmaticaly when the user load ...
0
votes
1answer
33 views

Magento 2 Observer after account confirm by email

I need to trigger a Email after the account is verified from email link by the customer, Need the observer.
0
votes
0answers
18 views

Exception Not Working

I have an observer for sales_order_save_before The custom message shows when the user is logged in, but throws the generic message if they are a guest. Does anyone know why this is happening?