File tree 1 file changed +16
-1
lines changed
app/code/Magento/InventoryShipping/Model
1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change 15
15
use Magento \InventorySourceSelectionApi \Api \Data \ItemRequestInterfaceFactory ;
16
16
use Magento \Sales \Api \Data \InvoiceInterface ;
17
17
use Magento \Sales \Api \Data \InvoiceItemInterface ;
18
+ use Magento \Sales \Model \Order \Invoice \Item as InvoiceItemModel ;
18
19
use Magento \Sales \Api \Data \OrderItemInterface ;
19
20
use Traversable ;
20
21
@@ -89,7 +90,7 @@ private function getSelectionRequestItems(Traversable $invoiceItems): array
89
90
{
90
91
$ selectionRequestItems = [];
91
92
foreach ($ invoiceItems as $ invoiceItem ) {
92
- if (!$ invoiceItem -> getOrderItem ()-> getIsVirtual ( )) {
93
+ if (!$ this -> canProcessInvoiceItem ( $ invoiceItem )) {
93
94
continue ;
94
95
}
95
96
@@ -106,6 +107,20 @@ private function getSelectionRequestItems(Traversable $invoiceItems): array
106
107
return $ selectionRequestItems ;
107
108
}
108
109
110
+ /**
111
+ * @param InvoiceItemModel $invoiceItem
112
+ * @return bool
113
+ */
114
+ private function canProcessInvoiceItem (InvoiceItemModel $ invoiceItem ): bool
115
+ {
116
+ $ orderItem = $ invoiceItem ->getOrderItem ();
117
+ if ($ orderItem ->isDeleted () || $ orderItem ->getParentItemId () || !$ orderItem ->getIsVirtual ()) {
118
+ return false ;
119
+ }
120
+
121
+ return true ;
122
+ }
123
+
109
124
/**
110
125
* @param OrderItemInterface $item
111
126
* @param string|int|float $qty
You can’t perform that action at this time.
0 commit comments