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
3 answers
844 views

get all order information from checkout_onepage_controller_success_action

I have an Observer for checkout_onepage_controller_success_action and I would like to load ALL order information inside this observer: order items, options, customer info. I have tried a number of ...
lms_forever's user avatar
0 votes
0 answers
128 views

In Observer sales_order_save_after Order Enitiy are not save any data of current order In Magento 2

In Observer sales_order_save_after Order Entity are not save any data of current order In Magento 2.3.5 I created the following function in helper and used an observer but not a success so save some ...
HAROONMIND's user avatar
0 votes
1 answer
114 views

customer_register_success not triggered when customer register using social login

I want to create an observer after a successful registration. customer_register_success not trigger when customer register using social login
Abhijith Prasad's user avatar
0 votes
1 answer
93 views

How to prevent inventory decrement on place of order

My requirement is on a specific order that inventory should not decrease from Default Stock or Quantity after placing the order. How can I Achieve it? Is it possible? Can I get some help.? Thank you ...
Praveen Negimani's user avatar
0 votes
1 answer
401 views

How to make automation after successful payment capture using order information

When a user makes an order on my Magento 2.4 website, I need to scrape all of the data of that order after the payment has been captured and send it to a third-party shipping company (DHL). Some of ...
MADT's user avatar
  • 21
0 votes
2 answers
547 views

Magento 2 dispatch observer without waiting for observer to finish

I am wanting to run some code that makes a request on product save, separate to the page product save happens on. I have correctly set up an observer that listens to the 'catalog_product_save_after' ...
Ben Dodson's user avatar
0 votes
0 answers
142 views

Magento 2: Is there an event when company gets created or can anyone tell me how to create custom event when company is created?

I wanted to automate the process of company approval, so I setup the status column default value in company table as 1. Now I want to send an email to the person as soon as the company is created. I ...
Shivani Singh's user avatar
1 vote
2 answers
178 views

Product resource saveAttribute method cause problems with ProductProcessUrlRewriteSavingObserver

I have a problem with ProductProcessUrlRewriteSavingObserver when I try to save product attribute data by the Product resource saveAttribute method. Magento 2.4.3 changes one validation method in this ...
Dominik Adamski's user avatar
0 votes
1 answer
528 views

Magento 2.4.2: redirection from Observer not working

I am getting 'ERR_TOO_MANY_REDIRECTS'. I tried solution from this link: Magento2: redirection from Observer public function execute(Observer $observer) { $this->actionFlag->set('', \Magento\...
explorer's user avatar
0 votes
0 answers
137 views

How to use 2 observer in same event in Magento 2?

I want to use 2 observer on 'sales_order_place_after' this observer as i have checked if i place one observer it works fine but how can i run 2 observer with one event. <event name="...
Prits's user avatar
  • 626
1 vote
1 answer
396 views

Magento2 Product Collection Observer only changes one page at a time

In ListProduct block Magento is using initializeProductCollection() to initialize the collection. While initializing it dispatches event catalog_block_product_list_collection as follows. $this->...
Richard Parnaby-King's user avatar
0 votes
2 answers
755 views

Magento 2: Remove discount applied(Coupon code applied) on place order event

I want to remove discount applied(Coupon code applied) when order is placed. Any help would be appreciated. My controller code: class Success extends \Magento\Checkout\Controller\Onepage implements ...
mechanic's user avatar
  • 360
0 votes
1 answer
1k views

Magento 2 : ERROR: Call to a member function getTelephone() on null

Getting error [2021-09-06 16:23:17] report.ERROR: Call to a member function getTelephone() on null {"exception":"[object] (GraphQL\Error\Error(code: 0): Call to a member function ...
devhs's user avatar
  • 230
3 votes
3 answers
220 views

Magento 2 : get customer attributes in sales_order_place_after event

I have created an extension attribute called "sms_subscribed" using data patch. I am trying to get it in observer. is their any way to get it ? OrderPlaceAfter.php use Magento\Framework\...
devhs's user avatar
  • 230
0 votes
1 answer
96 views

How to modify product data on observer pre cache?

My problem would be the following: I need to modify the product data on load after the product page was cached. Everytime I load a product I need to request some data to an api and overwrite certain ...
Henry Johnson's user avatar
0 votes
1 answer
424 views

How to add additional fee to subtotal of checkout/cart using events and observers? magento 2

Basically, I am trying to add additional fees to the subtotal of checkout/cart based on product_type. Here is what I tried but I am not able to get print_r($item->getBasePrice()); because I want to ...
J. Doe's user avatar
  • 259
0 votes
1 answer
171 views

Error message is not showing on Login Observer?

The error message is not showing on Login Observer if the error occours. observer file is : <?php namespace Orbitx\Emailblock\Plugin; use Magento\Framework\Controller\ResultFactory; use Magento\...
Prits's user avatar
  • 626
0 votes
1 answer
196 views

How to stop user login in Magento 2?

I want to stop user login in Magento 2 for some customers. So I created a back-end setting for customers to be blocked by the website and successfully get it done. But on the front end part, it is not ...
Prits's user avatar
  • 626
0 votes
2 answers
189 views

Update product main entry data inside catalog_product_save_after event

I'm trying to update 2 custom field I have created by the db_schema.xml file into my catalog_product_entity thats part working as its shut be and everything are working smooth. Now I'm trying to call ...
ParisNakitaKejser's user avatar
1 vote
1 answer
2k views

magento 2 catalog_product_save_before unable to save product

I'm trying to save the product in the observer of event "catalog_product_save_before", but somehow the admin panel is just loading its not saving product. Can anyone please suggest the ...
Yogesh's user avatar
  • 563
0 votes
1 answer
856 views

What event is responsible for the bulk product save in the admin in Magento 2?

Magento V2.4.1 We have created one attribute named "Test" with 2 values "test1" and "test2". We are required to automatically select the value "test2" when the ...
Chintan Kaneriya's user avatar
0 votes
0 answers
661 views

Which event gets dispatched when Update Cart action is triggered in magento 2?

I am trying to modify the subtotal in the checkout/cart page when the item gets updated using the Update Cart action button on the product page. After the product has been successfully added to the ...
J. Doe's user avatar
  • 259
0 votes
1 answer
427 views

Get customer ID after customer account registration

I created an event observer for when a customer subscribes to a newsletter. The event is working as expected and is being triggered when a customer subscribes within the account area or when creating ...
Greg's user avatar
  • 2,919
0 votes
1 answer
272 views

How to send an e-mail after adding the product to the cart in magento 2?

Unfortunately, so far I am a complete beginner in creating a module in Magento. I need to send an email after adding the item to the cart. As I understand it, I need to use the ...
Vova's user avatar
  • 3
0 votes
1 answer
138 views

Customer session model is not returning customer ID in class which was triggered by `customer_account_create` event

When using the customer_account_create event, the session model in my class is not able to return the customer ID using $this->customerSession->getId();. However, for testing purposes, when ...
Greg's user avatar
  • 2,919
0 votes
1 answer
133 views

Is there any event for Create/edit/delete attributes Magento 2.4.2

When the attribute is created/edited/deleted I need to trigger a URL for that I need an event the is help on that scenario in Magento 2.4.2. I checked some URL's i didn't understand which is working ...
Sabareesh's user avatar
  • 328
0 votes
1 answer
202 views

Magento 2.3 - Why observer triggers multiple times on 'newsletter_subscriber_save_after' event?

I am trying to send email when customer subscribes/unsubscribes from newsletter, however, my observer is triggering three times for some odd reason. Any ideas why or how to prevent it? The following ...
Greg's user avatar
  • 2,919
0 votes
1 answer
693 views

Magento 2 get session variable on checkout not working

I have been struggling with this issue like 2 days, and I don't understand why it's happening. This is what I'm doing: 1- Unset session variable in case it exists and Create a new session variable 2- ...
Oscar Vazquez's user avatar
0 votes
2 answers
125 views

How to redirect to custom cms in magento2

When quote table or customer session destroy page is rediecting to cart empty page. I want to redirect to my custom cms page. how to do that? I used below code but not working: $this->...
venkata prasad's user avatar
1 vote
1 answer
424 views

Customer save after Observer called Multiple times

I have an observe running after customer is saved, event used is customer_save_after which is working fine when trying to create a customer from front end, but when I create a customer from backend, ...
NileshPlus91's user avatar
0 votes
1 answer
127 views

getFullAction is not working when cache enabled

I'm looking to set different response headers for different pages. I have tried with controller_front_send_response_before. The problem is getFullAction method returned the value (cms_index_index) ...
Bilal Usean's user avatar
  • 9,907
0 votes
0 answers
211 views

Magento 2.4.2: how to add some charge(such as handling charge) to the FedEx shipping cost in the checkout page?

I would need to add some additional charge to the shipping cost shown by FedEx in the checkout page. In order to do this with custom code, I would like to know if there is an Magento event that gets ...
CodeForGood's user avatar
0 votes
1 answer
66 views

I have added one custom attribute for product named percentage. How can I add that attribute to product price after adding that product into cart?

I have tried below code. However its working fine but other products for which custom attribute is not being added from admin, I am not able to add to cart such products.
Naman Mehta's user avatar
0 votes
1 answer
485 views

Magento 2: Redirect with Data in Observer

I have this code to redirect to custom page from observer. But I wonder how to redirect from observer, and with data transfer to the redirected page. <?php namespace Namespace\Module\Observer; ...
fudu's user avatar
  • 1,258
0 votes
1 answer
168 views

Magento 2: Product listing page event

So I want to update the price of a specific products in product listing page programatically. To update, I created product attribute and I would like to take that value and update the price in an ...
Shivani Singh's user avatar
0 votes
1 answer
536 views

magento2 add simple product to order

I want add surprise functionality so when custom try to place an order, one simple product will get automatically added to their cart. I want to add that item after customer click on place order ...
Jackson Wyss's user avatar
0 votes
1 answer
715 views

Magento 2 How to pass variable from Controller to Observer on checkout_cart_product_add_after event

I'm trying to send a $price variable from a controller where I add to cart my product to checkout_cart_product_add_after event observer. Here is my Controller: public function execute(){ $...
Oscar Vazquez's user avatar
0 votes
1 answer
400 views

Magento 2 - How to retrieve the products id, price, quantity on successful order placement?

My Observer Class <?php namespace GCV\GenerateCSV\Observer; use Magento\Framework\Event\ObserverInterface; class GenerateCSV implements ObserverInterface { ...
Hybrid Developer's user avatar
0 votes
1 answer
536 views

Magento 2: Observer or Plugin for Mass Update Product Attribute

I have a custom attribute that I need to observe after the mass update product has been finished, this custom attribute is related to a category in another custom table, so if this custom attribute ...
jojo's user avatar
  • 149
1 vote
3 answers
2k views

How to use After order place event in Magento 2

After order place get customer attribute value and set order status in Magento 2. Thanks.
Mohit Patel's user avatar
  • 3,681
1 vote
1 answer
923 views

Magento 2.4: How to create Observer for "after save" event in custom module

I am using the custom module, in the backend, there are two fields, Field 1 manually entered Field 2 get the values based on Field 1. Here I want to get the Field 1 value in Observer after click save, ...
zus's user avatar
  • 155
1 vote
2 answers
403 views

Observer for mass product attribute queues

I would like to do some extra custom actions after a product price is changed. I was thinking to use the catalog_product_save_after event when a mass price update is done from the Product Grid -> ...
Attila Naghi's user avatar
  • 3,903
0 votes
1 answer
26 views

Observer not assigning a custom cart price

I've been working on this problem for some time now. When I add Item A to my basket I currently have it so it adds Item B with a custom price. Based on the number of Item A added to the basket, the ...
A. Fletcher's user avatar
0 votes
1 answer
35 views

Controller to Observer Conversion?

I am new to Magento 2 modules and would like to create a module to run the below class whenever someone accesses the homepage. I believe it would be easier if I converted this to an observer so I just ...
A. Andersen's user avatar
0 votes
1 answer
55 views

Can't get getCustomer() in custom event

If I observe customer_save_after event I can get information about the customer with $customer = $observer->getEvent()->getCustomer();. However, if dispatching my custom event instead of ...
zlep's user avatar
  • 168
0 votes
1 answer
1k views

How to get custom field values from quote table in observer?

I have added a custom field in checkout form and saved that values in quote table. And also displayed in the backend in order details. Now I want to send that custom field value in email. I have used ...
Rishi Saravadaa's user avatar
0 votes
1 answer
862 views

Not able to get parent_item_id for cart items retrieved from Order - Magento 2.3.5

I'm trying to get parent_item_id but it is returning null for all simple child products. $order = $observer->getEvent()->getOrder(); $items = $order->getAllVisibleItems(); foreach ...
Muhammad Saeed Khan's user avatar
1 vote
2 answers
1k views

Magento 2.4.1 Move Out of Stock In last Of Category Listing

I want to move out of stock product in last of the category listing, itried below code but same seems not working. app/code/Meetanshi/StockQuantity/etc/module.xml <?xml version="1.0"?> ...
user1799722's user avatar
0 votes
1 answer
227 views

Magento2 Custom Observer - Page Creation - getPage() within the observer - is not working for newly created pages

I have a custom observer to trigger some code when a page is saved/created. It's working great when I save a page - but it cannot see the new page when I create one - it is running the code but the ...
UrbanwarfareStudios's user avatar
0 votes
1 answer
852 views

magento event not fireing with graphql

i create a custom module in Magento 2.4 . I create an observer on the event "customer_register_success" . when i use graphql(i use pwa in frontend) the event is not firing but it work ...
rached's user avatar
  • 1

1 2
3
4 5
44