Questions tagged [event-observer]

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

1
vote
0answers
26 views

How to refresh minicart section from observer?

I am moving cart items to wishlist when store is switched using below code: etc/frontnend/events.xml <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:...
2
votes
1answer
24 views

Magento 2: Use Magento\Sales\Model\Order after order has been placed

I'm currently working on a custom module. I need to get order data of the order that has just been placed. The problem is, that I cannot get the data with Magento\Sales\Model\Order. It looks like the ...
1
vote
1answer
52 views

Update custom data for customer

I'm trying to Create new customer attribute "last_login_at" to store customer last login date time. My requirement is to update "last_login_at" data for the customer after the customer logged in. I ...
3
votes
2answers
85 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
34 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?
0
votes
1answer
52 views

Observer or plugin use before the invoice creation

I have create custom attribute("current_seller_id") in sales_invoice_item and now want to save some value in this column how can i do this. Actually i already save the value in sale_order_item table ...
1
vote
1answer
55 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
137 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
98 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
72 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
24 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
90 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
30 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
30 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
49 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
149 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
73 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
33 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
228 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
27 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
1answer
22 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
156 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
55 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
91 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
43 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
42 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
46 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
22 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
46 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
75 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
52 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
43 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
25 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
252 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 ...
2
votes
0answers
88 views

Observer for the event controller_action_predispatch not working for default Magento2 REST APIs [duplicate]

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
1k 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 ...
2
votes
0answers
21 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
38 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
29 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
18 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
82 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
125 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
62 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
80 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
1answer
33 views

Who can help, why the redirect does't work when the product is added to the cart?

Redirecttohome.php namespace namespace\modul\Observer; use Magento\Framework\Event\Observer; class RedirectToHome implements \Magento\Framework\Event\ObserverInterface { protected $...
0
votes
1answer
18 views

Prevent applying shopping cart rule for specific customer

Is it possible to prevent applying shopping cart price rule, for the specific customer, of the using event observer?
0
votes
1answer
296 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 ...