File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed
app/code/Magento/Bundle/Model/Sales/Order Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change 16
16
*/
17
17
class BundleOrderTypeValidator extends BundleShipmentTypeValidator implements ValidatorInterface
18
18
{
19
+ private const SHIPMENT_API_ROUTE = '/v1/shipment/ ' ;
20
+
19
21
/**
20
22
* @var array
21
23
*/
@@ -31,6 +33,10 @@ class BundleOrderTypeValidator extends BundleShipmentTypeValidator implements Va
31
33
*/
32
34
public function isValid ($ value ): bool
33
35
{
36
+ if (false === $ this ->canValidate ()) {
37
+ return true ;
38
+ }
39
+
34
40
foreach ($ value ->getOrder ()->getAllItems () as $ orderItem ) {
35
41
foreach ($ value ->getItems () as $ shipmentItem ) {
36
42
if ($ orderItem ->getItemId () == $ shipmentItem ->getOrderItemId ()) {
@@ -53,4 +59,14 @@ public function getMessages(): array
53
59
{
54
60
return $ this ->messages ;
55
61
}
62
+
63
+ /**
64
+ * @return bool
65
+ */
66
+ private function canValidate (): bool
67
+ {
68
+ $ url = \Magento \Framework \App \ObjectManager::getInstance ()->get (\Magento \Framework \Url::class);
69
+
70
+ return str_contains (strtolower ($ url ->getCurrentUrl ()), self ::SHIPMENT_API_ROUTE );
71
+ }
56
72
}
You can’t perform that action at this time.
0 commit comments