Description
Summary (*)
The Append Reservation Plugin only fires when creating an order is triggered via quote management. This leads to issues when a order is created directly. Following the order lifecycle by creating shipments and creditmemo will mix up the reservervations leading to wrongly rendered salable quantities for products.
Examples (*)
For automatically appending new reserverations an around plugin is used:
The plugged method:
https://github.com/magento/magento2/blob/2217274eb99b66a2c8e63cb488d0edaceb8f0ae3/app/code/Magento/Sales/Model/Service/OrderService.php#L261
is only used when creating an order via QuoteManagement. An order could also by placed via the order's model itself by using it's own place
function:
https://github.com/magento/magento2/blob/2217274eb99b66a2c8e63cb488d0edaceb8f0ae3/app/code/Magento/Sales/Model/Order.php#L1273
method.
This is even used inside the plugged method eventually:
https://github.com/magento/magento2/blob/2217274eb99b66a2c8e63cb488d0edaceb8f0ae3/app/code/Magento/Sales/Model/Service/OrderService.php#L264
Proposed solution
Since creating an order without going through a quote first is totally legit I suggest changing this, Utlizing the thrown event sales_order_place_after
inside the order's place
method would even be a way cleaner approach, since the order itself is not touched by the mechanism thus using an event is the better approach in my view.
I stumbled upon this when using a third party service that is creating orders as descriped (not via quotes).
Metadata
Metadata
Assignees
Type
Projects
Status