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
14 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
21 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
29 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
51 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
24 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
19 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
13 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
11 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
18 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
22 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
38 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
21 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 ...
0
votes
0answers
13 views

Observer not called on promo code apply button

I want to add a product to cart when a coupon is applied. I have created an observer and inside the execute method written code to fetch promo code. Also I have declared this event -...
0
votes
0answers
17 views

Is there a way to automate catalog:images:resize after a product import?

First off, all product data is being imported in to Magento. I know it's an issue that the images cache isn't created so after the import products show placeholder images and we can fix this by ...
0
votes
3answers
42 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.
1
vote
1answer
55 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, ...
1
vote
1answer
41 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 -> ...
0
votes
1answer
13 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 ...
0
votes
1answer
25 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 ...
0
votes
0answers
23 views

How to add a discount or apply a cart rule programmatically to quote in checkout_submit_before observer Magento 2

I want to apply some discounts amounts to the the quote, the observer I'm using is checkout_submit_before. There I have the access to the quote and order objects. How can I apply a cart rule or a ...
0
votes
0answers
14 views

How to delete order from observer Magento 2

I'm trying to perform an order alteration when the customer clicked on the "Place Order" button. What I'm trying to do is, remove a bundled product and add it's child product back to the ...
0
votes
1answer
27 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 ...
0
votes
1answer
48 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 ...
0
votes
1answer
32 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 ...
0
votes
1answer
130 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"?> ...
0
votes
1answer
28 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 ...
0
votes
1answer
35 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 ...
1
vote
1answer
66 views

Magento 2: Data printed in Controller but display null in observer

Controller file $collection = $this->investmentFactory->create()->load($id); $collection->getData(); // echo '<pre/>'; // print_r($collection->getData()); ...
0
votes
3answers
109 views

Magento 2 Place Order Programmatically Using Event Observer

Created a custom form where customer and product details filled with status of Active/Not active So for now I want to create an event and observer to place order programmatically when status is Active ...
0
votes
1answer
64 views

magento 2 - different email template based on order status

I have multiple status like 1: Pending 2: Processing 3: cancelled 4: completed When order is cancelled used get defualt status notification email, instead i want to use different template when order ...
0
votes
2answers
50 views

Magento2 Addtocart before plugin not working

I have created before plugin for Add to cart functionality to check if product's custom attribute called My Tshirt(which is text field type) value "Jack" or "Jill". Plugin work ...
0
votes
1answer
19 views

Get target url in layout before observer

I'm inside an observer <event name="layout_load_before"> <observer name="add_robot" instance="FranceTombale\Robot\Observer\NoindexfollowOnProduct" /> </...
0
votes
1answer
20 views

Quantity Change Event is inventory killer

Such unattended automatic quantity change events are a big hit on the SB inventories. Say you have handles 1,000 e. and your magento is synced to Quick Books for daily sales reporting. Magento ...
0
votes
0answers
32 views

How to detect product quantity change using observer in Magento 2.4.1?

We are using Magento 2.4.1 and we want to update the values of some custom attributes in the product whenever the product quantity is changed in the admin. Which events can be used to detect the ...
0
votes
1answer
37 views

Magento 2: Class instance

When i printed this print_r(get_class($this->getOrder())); I got this class name Magento\Sales\Model\Order\Interceptor What does this actually mean ? Where is this "Magento\Sales\Model\Order\...
1
vote
2answers
49 views

Magento 2 : How to pass custom data in existing event

I am trying to pass $pagedata = new \Magento\Framework\DataObject(array('name' => 'customdata')); $this->eventManager->dispatch('customer_login', ['customer' => $...
0
votes
2answers
60 views

getFullActionName() returns empty results for product pages inside predispatch observer

I have created an observer listening to the event controller_action_predispatch on a clean Magento 2.4.2 instance, and I tried to get the module name and full action name from within the observer. It ...
0
votes
2answers
33 views

Magento 2 : Get ordered item

I have used sales_order_place_after observer . i am trying to get product items but i get more items in data for exg. i have ordered 2 items but i am getting 4 items in data foreach ($order->...
0
votes
0answers
25 views

I want to develop cron for magento 2

In this cron I want to do the following things: cron should fetch products which has been created in the last 3 days. and also I have created some categories in the backend and I want to assign those ...
0
votes
3answers
26 views

Magento 2 : Get ordered products in sales_order_after observer

Is their any way i can get the product names in sales_order_place_after observer ? I get the order object but not sure how to fetch the products. Any thoughts ?
0
votes
0answers
29 views

Magento2 - Remove item shopping cart with observer

I have an issue with remove item shopping cart in Magento 2.3.1 with observer. When I remove item with conditional quality of product == 1 can not Delete, else quality product > 1 or have 2 product ...
0
votes
1answer
30 views

How to set phtml file in specific area Magento 1.9 using an Observer

I'm trying to set/ display a template file instead of the default messaging in Magento 1.9 using an Observer when the checkout loads but I cannot get the phtml file to show up and I don't know why?? ...
0
votes
1answer
25 views

Observer checkout_submit_all_after not called on magento 2.3.3

This is my app/code/Nadine/Campaign/etc/events.xml <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="...
0
votes
1answer
99 views

Create observer on “email_shipment_set_template_vars_before” and set template vars

I have created a observer on "email_shipment_set_template_vars_before" & trying to set some template var but its not working. any thoughts ? <?php /** * Copyright © Magento, Inc. All ...
0
votes
1answer
29 views

How to get customerId on sales_order_place_after observer?

I'm trying to get the CustomerId when an order is placed so that I can manipulate it before the order is saved to the DB. Vendor/Module/etc/frontend/events.xml <?xml version="1.0"?> &...
0
votes
0answers
35 views

Magento\CatalogSearch\Model\ResourceModel\Fulltext\CollectionFactory not work in observer

$category = $this->categoryFactory->create()->load($categoryId); $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $collection = $objectManager->create('Magento\...
0
votes
1answer
29 views

Magento 2: Customer Account Reorder button not showing

I have activated reorder in my magento 2 website. Now I wanted to build the functionality where if the customer click on the reorder button it will add all the products in the cart except for disabled ...
0
votes
1answer
39 views

Magento2 not able to get customer data in observer

I am using Magento 2.4.1, made observer. Event name is checkout_submit_all_after. I want to update order data, customer data, customer address data. Updating Order data is succeeded, but Other data ...
0
votes
1answer
24 views

Magento 2: Cancel order email sent to customer if admin cancel order

I am very beginner to magento and i am looking for answer, if i cancel order from admin panel but cancel email order is not sent to customer. If i want to sent email to customer what should i need to ...
0
votes
1answer
18 views

How to get ordered items in observer for “sales_order_place_after” event?

I am trying to get ordered items in sales_order_place_after event, but i am not able to log the ordered items. Here is the code which i have used. <?php namespace Vendor\Module\Helper; use ...

1
2 3 4 5
42