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
1answer
18 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 ...
0
votes
1answer
22 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 ...
0
votes
2answers
25 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' ...
0
votes
0answers
13 views

How to set category id to parent product in observer ? My event is 'catalog_product_save_after'

I'm creating simple product and assign that product to configure product and when simple product is assign it's parent category is will be change to default category .. How can i done this??? This is ...
0
votes
0answers
11 views

Getting stockItem before change not working on production server

I need to observe API's changes on stockItems from other sources coming to my store, although the below code is working on my local server, the old stock qty is always 0 on the production server. ...
0
votes
0answers
12 views

Magento 2 : How to Disable Allow Backorders Per Website

I'm looking for some help to create a simple module so I can disable "allow backorder" per website. We currently run Magento 2.3.6 and MSI is disabled. Can anyone help me with the file ...
0
votes
0answers
14 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 ...
0
votes
2answers
15 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 ...
0
votes
1answer
42 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\...
0
votes
0answers
7 views

How make HTTP status 404 for certain page - Magento 2

I try to make some pages with 404 status and ouptut 404 page but with current url. I do it in observer. This is my events.xml <event name="catalog_category_load_after"> <...
0
votes
0answers
10 views

Edit Cart Item with Additional Options

I have built an extension to handle a set of additional options for products. Each option is a drop down that is dynamically populated. The extension works fine for product added to cart from the ...
0
votes
0answers
31 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="...
0
votes
0answers
21 views

Magento 2.4: getting full action name null in controller_action_predispatch event observer for category page and product page

In controller_action_predispatch event observer, I'm getting the correct full action name, route name, controller name and action name for all pages in Magento 2.4 except category page and product ...
0
votes
1answer
15 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->...
0
votes
0answers
31 views

How to change email validation textInput event to focus-out event in checkout

In the checkout page, there is "Billing Email Address" input field which is validated when keyup event is triggered. This element has this data-bind attribute: data-bind="textInput: ...
0
votes
2answers
18 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 ...
0
votes
1answer
25 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 ...
3
votes
3answers
45 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\...
0
votes
1answer
14 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 ...
0
votes
1answer
27 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 ...
0
votes
0answers
13 views

Magento 2 - move layout on condition requires cache flush every time

I have implemented an observer at the event "layout_load_before". In observer, I have added a functionality to update the layout of a custom top link which is working fine. The issue is that ...
0
votes
1answer
18 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\...
0
votes
1answer
17 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 ...
0
votes
2answers
35 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 ...
1
vote
1answer
72 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 ...
0
votes
1answer
52 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 ...
0
votes
0answers
22 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 ...
0
votes
1answer
52 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 ...
0
votes
1answer
38 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 ...
0
votes
1answer
18 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 ...
0
votes
1answer
32 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 ...
0
votes
0answers
13 views

how to redirect sales_order_place_before event on checkout page on redirect?

I have used sales_order_place_before event in Magento 2 but on error it goes to cart page but i want it goes to checkout page first step. My observer code is : if(in_array($curruseradd, $fulladdress)){...
0
votes
0answers
22 views

Magento 2.3 - What is the footer subscription event?

I am trying to capture the event when customer is subscribing to the newsletter. I can capture the event when the customer is subscriber is using the account via "newsletter_subscriber_save_after&...
0
votes
1answer
28 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 ...
0
votes
1answer
69 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- ...
0
votes
0answers
11 views

Is there any way to change website (Sales Channel) stock on the fly (plugin or observer)

I have one website and three stocks, every stock is linked to one source, I also have a dropdown list which display those three sources as Stores (it is like Store Selector). What I want to do is ...
0
votes
0answers
20 views

Magento 2.4 doesn't send mail to admin on change order status from using Observer

In my Magento 2.4 store it doesn't send mail to admin on change order status from using Observer. By using this it just reload and show white screen when i change the order status from Admin. My ...
0
votes
2answers
44 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->...
0
votes
1answer
54 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, ...
0
votes
0answers
30 views

Magento 2.4.2: With an Magento event, how to add some value to the FedEx calculated shipping amount in the checkout page?

I'm looking for some Magento event to add a value(brokerage) to the shipping amount by shown by FedEx. Why I need it is to achieve the following. We have so far been shipping only within the US, but ...
0
votes
1answer
32 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) ...
0
votes
0answers
65 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 ...
0
votes
1answer
26 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.
0
votes
1answer
25 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; ...
0
votes
1answer
15 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 ...
0
votes
0answers
13 views

Magento2 obeserver or plugin before show the product

Maybe I do not see the forest for the trees, but I failed to find the following entry point: I need an event or function for a plugin, where I can add some data to a product. This data is relevant ...
0
votes
1answer
37 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 ...
0
votes
1answer
84 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(){ $...
0
votes
1answer
52 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 { ...
0
votes
1answer
88 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 ...

1
2 3 4 5
42