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

Magento2: Insert order grid data into a custom table using the sales_order_save_after event

I have created an observer with this event file. <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events....
Rana Zain's user avatar
  • 640
0 votes
0 answers
30 views

Magento 2 Mailchimp Guest customer fields are not sync on Mailchimp after order placed

Magento 2 Mailchimp Guest customer fields are not synced with Mailchimp after the order is placed. We are using Magento 2.4.5-p1 version and the Mailchimp version is 103.4.50 Except for Guest email ...
sumeet bajaj's user avatar
  • 1,286
0 votes
1 answer
89 views

Magento2: Issue with the customer custom attribute and custom tab in product view

This is the code snippet responsible for adding new attribute public function createAllowRequestSampleCustomerAttribute($setup) { $code = 'allow_request_sample'; /** @...
Dramorian's user avatar
0 votes
1 answer
26 views

show an error message in adding item to the cart if the user is not logged and the item have price greater than 100 that item shouldnot added to cart

''' public function execute(Observer $observer) { $item = $observer->getEvent()->getData('quote_item'); $product = $item->getProduct(); if ($product->...
Arun's user avatar
  • 1
0 votes
0 answers
20 views

Magento 2: Override theme conditionally fails

I have a certain route in my store for which I want to switch to magento's luma theme. I used the layout_load_before event and created an oberserver to do that: namespace My\Module\Observer; class ...
omsta's user avatar
  • 698
1 vote
1 answer
37 views

Redirect to Home after login

I've been strugling with this a lot, I have to redirect the users to Home when they login to the site. I've been following solutions given in other questions about the same, but nothing works, here ...
Eduardo Fuentes's user avatar
0 votes
0 answers
19 views

How to toggle custom tab visibility in product view with event observer based on custom attribute's value (custom layout handle)?

There is a custom tab "Ask Question" in a product that has a form (it has a logic for saving data to the database). My task is to create an event observer for the attribute that I have ...
Dramorian's user avatar
1 vote
1 answer
45 views

Not Display Product Name in the Email template?

module.xml <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/...
Thoubik's user avatar
  • 128
0 votes
0 answers
20 views

Magento 2.4: Pass jQuery value into checkout_cart_product_add_after observer

I have done some custom price calculation on product page using jQuery and I want to add the calculated price to the product during addtocart event. Any help would be appreciated.
mechanic's user avatar
  • 440
1 vote
0 answers
30 views

i need to create a observer that will change all products prices on category page

this is my events.xml code <?xml version="1.0" encoding="UTF-8"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation=&...
Zahab Abbas's user avatar
0 votes
1 answer
32 views

Change layout based on url parameter - Magento 2.4

We created a custom module, to load a observer before layout_load_before. And then we would like to change the custom layout, based on a url parameter ?content-only=yes. For some reason it does not ...
JGeer's user avatar
  • 1,416
0 votes
1 answer
42 views

how to create a customer by using two fields passwords and confirm password in email section on magento2 checkout?

I have two fields created at the email section in checkout in magento2. I want to create a customer on order place. I am currently using "sales_order_payment_save_before" to get field data ...
Magento Inquiry's user avatar
0 votes
0 answers
28 views

Write Magento2 Custom Module to set Minimum Order Amount for Selected Customer Groups

I developed a Magento 2 module to add customer groups dropdown in admin panel Store-> Configuration -> Sales -> Minimum Order Amount so I can set min order amount only for some customer ...
Armi_Raz's user avatar
0 votes
1 answer
97 views

Getting child product of configurable in Observer?

Magento 2.4.6 I am listening to the checkout_cart_product_add_after event. In my observer I am trying to get an attribute from the added child product. I did not manage so far, all data that I get is ...
user4095519's user avatar
0 votes
1 answer
84 views

Magento 2 - Get Stock Update Observer

My observer is not getting product information, this line is always printed $this->logger->info('Product object is always null.'); <?php namespace Custom\Module\Observer; use Magento\...
Madking's user avatar
2 votes
3 answers
275 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
1 vote
1 answer
46 views

Event observer hangs on order creation

Situation: I'm creating a Magento 2 module that listens to specific event observers, gets the ID's associated with those events, and sends them to a third-party Node app. This Node app will receive ...
cereallarceny's user avatar
0 votes
0 answers
25 views

Update product quantity after place an order with my own Observer event

I have created a new Observer event where I check sibling products. Sibling product are products with same pid. After placing the order, I would like to reduce the quantity of siblings of the product ...
beata's user avatar
  • 1
0 votes
0 answers
28 views

Skipping min sale qty validation when adding product to cart?

Magento version 2.4.6 I am listening to the checkout_cart_product_add_after event to modify the price of a product when it is added to the cart. That works just fine. Now, if the product has a min ...
user4095519's user avatar
0 votes
2 answers
98 views

sales_order_item_cancel Event Not Triggered when Canceling Order Programmatically using $this->orderManagement->cancel($orderId);

I'm currently working on a module that involves the programmatic cancellation of orders. To cancel orders, I am using $this->orderManagement->cancel($orderId); in my code. This appears to be ...
makey's user avatar
  • 15
1 vote
0 answers
15 views

Changing item name when being added to cart? [duplicate]

Magento 2.4.6 I am using the checkout_cart_product_add_after event to modify the price of the product which is added to the cart. This works just fine. Changing the name however does not work. I tried ...
user4095519's user avatar
1 vote
2 answers
52 views

Getting simple product in observer when adding configurable product to cart?

Magento 2.4.6 I am trying to get the simple product of a configurable product when a product is added to the cart. I am listening to the checkout_cart_product_add_after event. This is what I have so ...
user4095519's user avatar
0 votes
1 answer
33 views

Knowing which button was clicked on the product page in an observer?

Magento 2.4.6 I added a button to my addtocart.phtml. Below the button I added a hidden field, like this: <button type="submit" title="<?= $buttonSampleTitle ?>" ...
user4095519's user avatar
0 votes
1 answer
93 views

How magento schedule update for magento product programmatically?

How i magento perform schedule update programmatically. which module i check, how magento perform schedule update ? please narrate which file work ?
Alok Tiwari's user avatar
0 votes
1 answer
89 views

How magento 2 default content scheduling work programmatically

what is the logic behind the content scheduling in magento 2. Using cron ? using event observer ?
Alok Tiwari's user avatar
1 vote
0 answers
35 views

Dispatch custom event for all methods that extends a parent method

I'm developing a module that will be extended by other modules. Here I will call the parent module as parent and the "child" module (the module that will extend the classes from parent) as ...
Matheus Delazeri's user avatar
0 votes
1 answer
55 views

How can i put the value from observer/event into a dropdown

I have a dropdown menu, How can i put the value from observer or event to a dropdown on checkout page. Thank you in advance.
vinz vinz's user avatar
0 votes
1 answer
186 views

Trying to listen to the add to cart event

This is my first time playing around with Magento. I'm building a module and I want to listen when a product is added to the cart so, I've tried to use the ...
kevkevdev's user avatar
0 votes
0 answers
18 views

Magento 2: Dynamically ignore tier price configuration upon add to cart action

I have modified a product in a way that you can either buy it "as usual" or decide to buy it as a subscription (via custom options). If you decide to buy as subscription tier prices should ...
omsta's user avatar
  • 698
0 votes
0 answers
17 views

Magento 2: Dropdown function before "Place Order"

Good day! i'm a newbie in magento, i've already created a custom payment method. I would like to replace the "success" and "fraud" into payment gateway e.g. Paypal & Paymaya. ...
vinz vinz's user avatar
0 votes
0 answers
17 views

How is it possible to stop sending any type of mail from Magento 2 based on the customer email value?

I am working on Magento 2.4 version and certain events that were available in older versions are not there now. I guess a plugin would be an ideal solution to this. Any suggestions would be much ...
Arjun B's user avatar
  • 66
0 votes
2 answers
514 views

Magento 2: How to pass the parameters to another URL?

I'm new in magento 2, my question is how to send parameters with results responses to another url whenever i click "Place Order" and before proceeding to success page. Using event and ...
vinz vinz's user avatar
0 votes
1 answer
442 views

magento 2 - list sales order status all events

I search for all events used for sales order status. sales_order status events magento 2.4.4
arun's user avatar
  • 3
0 votes
1 answer
29 views

Magento Observer Dispatching

I am little bit confuse about Observer Dispatching. What it means by. Can Anybody expalins me.
Rana Zain's user avatar
  • 640
0 votes
1 answer
340 views

Magento 2 Unable to update customer data during passing to customer login observer

In magento 2 I am trying to update session_cutoff column in table customer_entity during login Below is my code which I add in observer using event customer_login public function execute(\Magento\...
Mohd Farhan Bin Ramli's user avatar
0 votes
1 answer
28 views

How to get the current product details in Observer without registey

How to get the current product in Observer instead of this "$product = $this->_registry->registry("current_product");" I need the code for without registry in the observer.
venkata prasad's user avatar
0 votes
3 answers
187 views

How to get current product in magento 2 observer without registry

I need to get the current product details in magento2 observer without using the registry.because magento latest version is deprecated this registry. I need the current product for reviews. when ...
venkata prasad's user avatar
0 votes
0 answers
204 views

Magento 2.4 : How to save delivery comment in order and in database?

I'm using Magento 2.4.4 and PHP 8.1 . How can i use the order comment as show in screenshot but use it in shipping method as delivery comment and save comment in sales_order &quote table? I have ...
Bayzel's user avatar
  • 187
0 votes
1 answer
48 views

Intercept payment method change

I am working on a custom extension where I need to call an observer when any payment method is selected from the available payment method list on the frontend checkout page. Unfortunately, I didn't ...
iupaem's user avatar
  • 41
0 votes
2 answers
499 views

Magento 2 - Class not found

I always get this error if I try to load my site, even though the class does exist. PHP Fatal error: Uncaught Error: Class 'Company\\App\\Observer\\Frontend\\Controller\\ActionPredispatch' app/code/...
Black's user avatar
  • 3,280
0 votes
1 answer
89 views

How to insert html content on a page in Observer?

How to insert html content before the </body> tag, via Event and Observer on each page?
Eugene Morrison's user avatar
1 vote
1 answer
121 views

Can I use sitemap_products_generating_before event to modify Product Sitemap in Magento2?

In Magento 1, sitemap_products_generating_before event allows us to modify the Product Sitemap. Can I use sitemap_products_generating_before event names in Magento 2.4? I want to filter the product ...
mr.hironobu's user avatar
0 votes
2 answers
98 views

How do I transfer data from one Observer to another?

I need to pass the value of a variable from one Observer that monitoring the cms_controller_router_match_before event to an Observer that monitoring the cms_page_render event. How can this be done ...
Eugene Morrison's user avatar
1 vote
1 answer
37 views

Observer display return to frontend

I would like to display the result from Observer to every page, any way I can do it? app/code/MyVendor/GeoIp/Observer/GeoObserver.php <?php namespace MyModule\GeoIp\Observer; use Magento\...
hill2011's user avatar
1 vote
2 answers
497 views

Magento 2 - detect orders that are placed via REST API

Is there a way to detect orders that are placed via API? I want to add to those orders a different order number prefix. I have already created an observer that is changing the prefix based on payment ...
andy1786's user avatar
  • 105
1 vote
1 answer
235 views

magento 2.4 observer on product image change

I have a grouped with some associated products. When the image on the grouped is updated, I'd like to save the same image on the associated products also. I tried with the "...
Lou Nik's user avatar
  • 423
1 vote
1 answer
736 views

Magento 2.4 - Observer For Catalog Product Save After Not Working

I have referenced a few different questions here and other articles online, but cannot for the life of me determine what is going wrong. Referenced: Event not triggered when new product added in ...
taskle's user avatar
  • 365
2 votes
1 answer
77 views

unable to get the Customer Custom Attribute value in customer_register_success event in magento 2

In my project a custom customer attribute was using and save the value in the table on customer registration. Attribute id was phone_number I want to get this phone number value and send an sms using ...
Mujahidh's user avatar
  • 2,791
1 vote
1 answer
408 views

Magento 2.4.4: How to get Gift Message from Order object in my Observer class subscribed to checkout_onepage_controller_success_action?

With upgrade to Magento 2.4.4, I'm using checkout_onepage_controller_success_action to get order information that I insert into a custom table that I created in Magento. We're allowing customers to ...
CodeForGood's user avatar
1 vote
2 answers
59 views

Magento 2.3.5 order email observer custom block enable to pass array

I have tried the following: Observer ... $transport = $observer->getTransport(); $transport->setTemplateVars([ 'products' => [ ['name' => 'Product1'], ['...
Juliano Vargas's user avatar

1
2 3 4 5
44