Skip to content

Commit 19cd5aa

Browse files
committed
AC-14049: Missing Billing Address Error in Admin Dashboard When Creating Order via REST API with Only Payment Information
1 parent 2fc6f36 commit 19cd5aa

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

app/code/Magento/Sales/Plugin/Model/OrderRepositoryPlugin.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ class OrderRepositoryPlugin
2323
* @param OrderInterface $entity
2424
* @return array
2525
* @throws LocalizedException
26+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
2627
*/
2728
public function beforeSave(OrderRepository $subject, OrderInterface $entity): array
2829
{
@@ -60,12 +61,5 @@ private function validateOrderItems(OrderInterface $entity): void
6061
if (!$items || count($items) === 0) {
6162
throw new LocalizedException(__('Please specify order items.'));
6263
}
63-
64-
// Validate each item has required data
65-
foreach ($items as $item) {
66-
if (!$item->getProductId() || !$item->getSku()) {
67-
throw new LocalizedException(__('Order items must have valid product information.'));
68-
}
69-
}
7064
}
7165
}

app/code/Magento/Sales/etc/webapi_soap/di.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,9 @@
2626
<plugin name="add_existing_product_options"
2727
type="Magento\Sales\Plugin\Model\ResourceModel\Order\Relation\AddExistingItemProductOptions"/>
2828
</type>
29+
<type name="Magento\Sales\Model\OrderRepository">
30+
<plugin name="validate_billing_address_on_save"
31+
type="Magento\Sales\Plugin\Model\OrderRepositoryPlugin"
32+
sortOrder="10"/>
33+
</type>
2934
</config>

0 commit comments

Comments
 (0)