Hello
I am trying to make a payment with PayPal and place the order, at the link paypal/express/placeOrder/ is showing me this issue:
Uncaught TypeError: Argument 2 passed to Magento\InventorySales\Plugin\Sales\OrderManagement\AppendReservationsAfterOrderPlacementPlugin::afterPlace() must implement interface Magento\Sales\Api\Data\OrderInterface, null given, called in ...
This is the code on line 119:
public function afterPlace(OrderManagementInterface $subject, OrderInterface $order): OrderInterface
{
$itemsById = $itemsBySku = $itemsToSell = [];
foreach ($order->getItems() as $item) {
if (!isset($itemsById[$item->getProductId()])) {
$itemsById[$item->getProductId()] = 0;
}
$itemsById[$item->getProductId()] += $item->getQtyOrdered();
}
$productSkus = $this->getSkusByProductIds->execute(array_keys($itemsById));
$productTypes = $this->getProductTypesBySkus->execute($productSkus);
foreach ($productSkus as $productId => $sku) {
if (false === $this->isSourceItemManagementAllowedForProductType->execute($productTypes[$sku])) {
continue;
}
$itemsBySku[$sku] = (float)$itemsById[$productId];
$itemsToSell[] = $this->itemsToSellFactory->create([
'sku' => $sku,
'qty' => -(float)$itemsById[$productId]
]);
}
$websiteId = (int)$order->getStore()->getWebsiteId();
$websiteCode = $this->websiteRepository->getById($websiteId)->getCode();
$stockId = (int)$this->stockByWebsiteIdResolver->execute((int)$websiteId)->getStockId();
$this->checkItemsQuantity->execute($itemsBySku, $stockId);
/** @var SalesEventInterface $salesEvent */
$salesEvent = $this->salesEventFactory->create([
'type' => SalesEventInterface::EVENT_ORDER_PLACED,
'objectType' => SalesEventInterface::OBJECT_TYPE_ORDER,
'objectId' => (string)$order->getEntityId()
]);
$salesChannel = $this->salesChannelFactory->create([
'data' => [
'type' => SalesChannelInterface::TYPE_WEBSITE,
'code' => $websiteCode
]
]);
$this->placeReservationsForSalesEvent->execute($itemsToSell, $salesChannel, $salesEvent);
return $order;
}How can I solve this?
Our current Magento Version is 2.3.9 and, previously we had 2.3.4
Thanks
Please check custom modules have any plugin override on method place