1

I have an event observer listening on checkout_cart_product_add_after which works when adding products to the cart from the product, category, and wishlist pages, but when adding products to the cart from the B2B requisition list that event is not fired.

I haven't been able to find anything as to why that event does not fire when adding products from a requisition list. I'm hoping someone here knows of a similar event that is fired when adding products to the cart from a requisition list because I have not been able to find anything on this short of reading the code.

1 Answer 1

1

I ended up having create a plugin for afterPlaceItemsInCart in \Magento\RequisitionList\Model\RequisitionListManagement. Below is the basics of what I used.

<?php namespace Vendor\Module\Plugin\RequisitionList; use Magento\Checkout\Model\Session as CheckoutSession; /** * Class is responsible for actions with requisition list items. */ class RequisitionListManagement { /** * @var \Magento\Checkout\Model\Session */ protected $_checkoutSession; public function __construct( CheckoutSession $checkoutSession ) { $this->_checkoutSession = $checkoutSession; } public function afterPlaceItemsInCart(\Magento\RequisitionList\Model\RequisitionListManagement $subject, $result) { $cartItems = $this->_checkoutSession->getQuote()->getAllVisibleItems(); // Did all my stuff here $this->_checkoutSession->getQuote()->collectTotals()->save(); return $result; } } 

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.