New answers tagged

0 votes

I am confused which observer should I use for an order placed event in magento 2?

I want to suggest 2 events which detailed scope and information: checkout_submit_all_after: I will be going with this if I just need to get order information. sales_order_place_after: I will be ...
user avatar
  • 1,172
1 vote
Accepted

Magento 2.4.2: The following modules are outdated: Perfectmakeupmirrors_PmmHead schema: current version - none, required version - 0.0.1

Keep your database backup before do it. delete your module entry from setup_module table. Ex. SELECT * FROM setup_module where module = "Perfectmakeupmirrors_PmmHead"; delete FROM ...
user avatar
  • 1,049
1 vote
Accepted

Magento 2.4.2: observer class not getting invoked on event layout_load_before

The event name is correct and it should work. It is better to debug in where "layout_load_before" event is defined which is shown below. vendor/magento/framework/View/Layout/Builder.php: ...
user avatar
1 vote

Magento 2.4.2: observer class not getting invoked on event layout_load_before

The class name you mentioned in events.xml is different from the one you uploaded. Please change events.xml to include instance as below instance="Perfectmakeupmirrors\Order\Observer\...
user avatar
0 votes

Magento 2.4.2: How to find out if it is category page in the observer class?

use Magento\Framework\Event\ObserverInterface; use Magento\Framework\Registry; class Noindexfollow implements ObserverInterface { protected $request; protected $registry; protected $...
user avatar
  • 1,049
0 votes

Setting a custom item subtotal when adding product to cart?

Check to see if $item->getQuote()->getId() gives a valid quote ID. If it does not then you may not have access to the quote itself and can try adding: use \Magento\Checkout\Model\Cart; ... /** ...
user avatar
0 votes

Magento 2: Get extension attributes data before customer address is saved

Have you correctly declared the extension attributes via extension_attributes.xml? You will have to declare verification_status along with the expected type for Magento\Customer\Api\Data\...
user avatar
1 vote
Accepted

Magento 2 passing parameter from observer to itself

You can use the "normal" php Session. // SET PARAMETER VALUE $_SESSION['PARAMETER_NAME'] = SOME OBJECT // GET PARAMETER VALUE $value = isset($_SESSION['PARAMETER_NAME']) ? $_SESSION['...
user avatar
  • 1,107
0 votes

Magento2.4 - stock quantity deducted twice in observer

you should not use sales_order_place_after event for quantity update, that event will fire on every save statements Ex. $order->save(). try with "checkout_submit_all_after" or "...
user avatar
  • 1,049
0 votes

Magento2.4 - stock quantity deducted twice in observer

Are you using Multi Source Inventory feature in magento? If yes, it would automatically reduce the saleable quantity of an item when the order is placed. Magento uses reservations to calculate and ...
user avatar
0 votes

Magento2.4 - stock quantity deducted twice in observer

Go to Admin Panel's Configuration and disable Decrease Stock When Order Is Placed in the Stock Options Stores->Configuration->Catalog->Inventory->Stock Options->Decrease Stock When ...
user avatar

Top 50 recent answers are included