Questions tagged [event-observer]
Event/observer is used to work dynamically with Magento without altering the core code.
2,153
questions
0
votes
1
answer
237
views
How to change first name in shipping address on this page using event observer magento 2?
Please explain with examples and provide the code of execute method if possible.
3
votes
1
answer
1k
views
How can I change the shipping price at checkout with an observer or plugin?
The shipping method may be flatrate or FedEx or freeshipping, but I want to override this price with $1. How can I do this?
0
votes
2
answers
176
views
override checkout index controller
I would like to override only one line in checkout/index/index controller.
do I need to use preference or plugin or observer?
if (!$this->_customerSession->isLoggedIn() && !$...
1
vote
1
answer
168
views
I have added a custom attribute in PDP page, I want to get that value in Observer/SaveToQuote.php to save in the quote table
I have added a custom attribute in PDP page, I want to get that value in Observer/SaveToQuote.php to save in the quote table after the product is added to cart. I am using the event ...
0
votes
1
answer
1k
views
How to set data to my custom column in sales_order table?
I have made 2 custom columns named selected_delivery_date and selected_delivery_time in quote_item and sales_order tables. I successfully added the values of these 2 columns in quote_item table using ...
1
vote
1
answer
30
views
Event Observer on the orders grid if someone selects an order and uses one of the actions in the drop down menu items
If someone selects and order by checking the box and then using one of the action items in the dropdown. I would like to add the user and timestamp and the action item they selected to the comments ...
0
votes
2
answers
128
views
Magento 2: How to get existing mini cart product's category ID in checkout_cart_product_add_before observer?
I am trying with following code.
public function execute(Observer $observer){
$quoteId = $this->_checkoutSession->getQuote()->getItems();
$quote = $this->_checkoutSession->...
1
vote
2
answers
179
views
sales_order_save_before etc/frontend/events.xml not working properly
I've used the sales_order_save_before event scope is etc/events.xml - This is working fine but,
etc/frontend/events.xml not working properly.
sales_order_save_before event not support frontend scope?
0
votes
1
answer
441
views
Order Updated At Date same as Created At
I am using the after plugin for the Place method following this link https://www.rakeshjesadiya.com/create-plugin-after-place-order-action-checkout-magento-2/
But I get the order updated at the date ...
0
votes
1
answer
45
views
Shipment comment add event observer mangento 2
I want to send sms on shipment comment add. is their any observer for knowing comment has been added to the shipment.
1
vote
2
answers
211
views
Observer that runs when an order is attempted to be created in the Admin
I need to create an observer or plugin or something else that will run when an order is attempted to be created through the admin. I added a custom attribute for customers (offline/online). If the ...
0
votes
1
answer
28
views
Insert content in product page
I need to insert (via my payment module) html element (div) somewhere (for example under Add to cart button) at product page view.
Should I use event/observer, or maybe there is something other?
...
1
vote
2
answers
61
views
exclude some other product in the cart from receiving discount
How to get product value ( product price) if attribute "logitech" is set to yes [attribute is Boolean].
I'm new here, still learning magneto. below code, calculate all items in the cart but ...
0
votes
2
answers
40
views
Magento 2 Module Events
I'm new to magento module development and trying to write my own little module.
Unfortunately, I'm having trouble understanding how to connect events to a REST request.
What I want to achieve:
...
0
votes
1
answer
236
views
How can I intercept a sale order created from within the admin panel in Magento 2?
I need to write data to an extension attribute after the order is created from within the admin panel. The extension attribute is the admin user's first and last name. How do I intercept this the ...
1
vote
1
answer
222
views
How to intercept customer order in Magento 2?
When an order is submitted, I need to write data to extension attributes. I need to either create an event observer or plugin. How do I do this the right way?
0
votes
1
answer
695
views
Magento 2: How can I add new field and save data to newsletter database table?
How can I save data in a new field in newsletter table of database? This is how I created my module based on other answers, but no one of aproaches worked. The fields of column c_firstname is always ...
0
votes
1
answer
116
views
Reset billing address to default address
I'm trying to (re)set the billing address to the customers default billing address after receiving an order (this is for B2B clients which are not allowed to change their billing address). To do this, ...
0
votes
2
answers
639
views
Magento 2.4: Which event triggers when the category page is loaded in magento2?
I want to know which event is triggered when a category page is loaded from the megamenu?
I want to load a custom collection of data based on a particular category.
1
vote
1
answer
192
views
Magento2: url redirection in controller_action_predispatch observer with setting post parameters
I am working on cms page restriction for specific customer group.I am using controller_action_predispatch event observer to check whether the current page is set for restriction and the current ...
0
votes
1
answer
631
views
Magento 2.4.2: The following modules are outdated: Perfectmakeupmirrors_PmmHead schema: current version - none, required version - 0.0.1
I just created a custom module to add a metatag in a category page of our Magento site by making use of event and observer. When reloading the category page, below is the error I see. I re-ran the ...
0
votes
2
answers
159
views
Magento 2.4.2: observer class not getting invoked on event layout_load_before
My objective is to set NO INDEX, NO FOLLOW to a specific category page in an observer class. Below is my event.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/...
0
votes
1
answer
491
views
Magento 2.4.2: How to find out if it is category page in the observer class?
My objective is to set a specific category to NO INDEX, NO FOLLOW in an observer class. Below is my event.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/...
0
votes
1
answer
622
views
Magento 2: Get extension attributes data before customer address is saved
We have created an extension attribute which we would be accepting via customer address REST API
Endpoint: PUT customers/:customerId
Request body:
{
"customer": {
"email": &...
0
votes
1
answer
247
views
Setting a custom item subtotal when adding product to cart?
Magento 2.4
I already have my observer in place, but setting a custom subtotal for my item does not work. I am listening to the checkout_cart_product_add_after event. This is my observer code:
$item = ...
0
votes
1
answer
164
views
Magento 2 passing parameter from observer to itself
I made an observer for the catalog_product_save_after event.
I need to do some changes to the "brother" products.
To do this, I get the parent product id and then all his childens.
For each ...
1
vote
3
answers
799
views
Magento2.4 - stock quantity deducted twice in observer
I'm using Magento 2.4.3-p1 and I'm trying to decrease stock quantity with custom observer while placing an order, but salable quantity is decreasing twice, my events and observer file are this:
etc/...
1
vote
2
answers
370
views
When i disable an observer found this type of error "This observer does not exist to be disabled."
Does any one have any idea about this type of issue?
1
vote
1
answer
36
views
How can i perform event and observer in Magento 1.9?
I need urgent solution. I'm newbie Magento Learner. How can I complete this task.
Before Product save -> Build Event -> print die in Observer.
0
votes
0
answers
623
views
Magento 2 change product attributes before saving
I have used the catalog_product_save_before event like below.
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:...
1
vote
0
answers
618
views
Programmatically update Stock Status Magento 2
I am trying to update Stock Status when the quantity is updated. Either from admin or web API (rest).
app/code/Namespace/Module/etc/events.xml
<?xml version="1.0" ?>
<config xmlns:...
1
vote
1
answer
66
views
How to save posta code in custom zip_code field in sales_order table in magento2
I have created a custom zip_code field in the sales order table. I want to save the postal code in my custom zip_code field after place an order.
please check the below code
events.xml
<?xml ...
0
votes
2
answers
538
views
Updating Product price using Observer
i am trying to update product price when product is added to cart
It works and the price is updated but it does not allow me to add any other product to the cart except the product where condition ...
0
votes
1
answer
199
views
Gift Card Quote Item Prices are NULL in cart related events
I want to do some customization when a gift card is added to cart so I have created a module observer with event checkout_cart_product_add_after, I am getting the product id, product type on the quote ...
0
votes
1
answer
1k
views
Understanding data bind at minicart in magento 2
I am using magento 2
in mini cart, I am trying to get the event during which product is being added and removed, a specific item not by cart
shown is the item that exists in mini cart, I want that ...
0
votes
1
answer
58
views
Get order data in different language?
I'm trying to fetch the order and/or the product data, but translated to a specific language/store view from an observer. This will send out an internal email so the order will be handled. Im calling ...
0
votes
1
answer
360
views
How to get custom attribute value in after product collection load in Observer
I want to get multiple select type custom attribute values in product collection observer,
I have tried with some events catalog_block_product_list_collection, ...
1
vote
2
answers
238
views
Where to find shipment event in Magento2
I am trying to build a custom module that will trigger off a text message when Magento receives shipping information on orders.
I know I can trigger off email, sms etc when an order is placed by ...
0
votes
1
answer
43
views
event sales_order_shipment_save_after is not working in magento 2.3.4
The event sales_order_shipment_save_after is not working in magento 2.3.4 after shipment submit.
event.xml file
SubmitShipmentAfter.php file
addWriter($writer); $logger->info($result); } }
0
votes
2
answers
244
views
Magento 2 Get In Cart Product Brand, Variant and Quantity
in Magento 2 I am trying to get below details of the product from the customer cart
Name
ID
Price
Brand
Category
Variant
Quantity
This process I added in observer during customer proceed to checkout
...
0
votes
1
answer
88
views
Update IsInStock attribute in observer by 'catalog_product_save_after' event in Magento2.3
I have tried this code in Magento 2.3.4
1.created events.xml in Dapl\Shortdurability\etc\adminhtml
2.created Productsaveafter.php in Dapl\Shortdurability\Observer.
<?php
namespace Dapl\...
0
votes
1
answer
692
views
Call to a member function getResponse() on null in observer while generating the shipment in magento2.4.3
<event name="sales_order_shipment_save_before">
<observer name="test_beforeshipment" instance="Module\ModuleName\Observer\BeforeShipment" />
</event>...
2
votes
2
answers
470
views
What event is fired after a customer places an order?
so I've been looking to do some adjustments with an observer by listening to the event that is fired after a user successfully places an order, whether in the backend or the frontend. But, I don't ...
0
votes
2
answers
837
views
How to get the selected payment method when the "sales_order_save_after" event is fired?
I'm developing an observable that listen to the sales_order_save_after event.
I have the order information executing $observer->getEvent()->getOrder() but i cannot get the payment method ...
0
votes
1
answer
121
views
Session parameter set in backend observer not persisting after upgrade to 2.4.3
We have a backend observer that sets a session variable after a shipment is created (sales_order_shipment_save_commit_after).
It's been working for over 2 years, but after the latest upgrade to 2.4.3-...
1
vote
0
answers
492
views
How do WeltPixel Google TagManager extension works
I am using Magento 2.3.5-p2
In it, my team have installed the WeltPixel Google Tag Manager Extension (GTM)
this extension is to make the process of GTM Implementation easier
the way that the GTM works ...
0
votes
2
answers
826
views
Include js file script in php observer file
I am using Magento 2.3.5-p2
I am adding a new module to add an Observer that will trigger some js code during an event that happens
below are the file and its content I have added
File Name and Path :
...
1
vote
0
answers
90
views
Magento 2 Get Event When User View List Product, Sorting, Filter, Clear Options, Pagination, Add Wish List
I am using Magento 2.3.5-p2
As stated in the title, I want to capture an event by the user when the user does any of the processes below
User View List Product
User Sort Product
User Filter Product
...
1
vote
0
answers
1k
views
Magento 2: Get custom field value from checkout in observer
I have created a custom field on checkout before shipping method like this:
etc/di.xml :
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&...
0
votes
1
answer
563
views
create event/observer of click new custom button
I need to create a new button in edit address book page, and an email will be sent once we click on this button, any suggestions please?