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 1616 */
1717class BundleOrderTypeValidator extends BundleShipmentTypeValidator implements ValidatorInterface
1818{
19+ private const SHIPMENT_API_ROUTE = '/v1/shipment/ ' ;
20+
1921 /**
2022 * @var array
2123 */
@@ -31,6 +33,10 @@ class BundleOrderTypeValidator extends BundleShipmentTypeValidator implements Va
3133 */
3234 public function isValid ($ value ): bool
3335 {
36+ if (false === $ this ->canValidate ()) {
37+ return true ;
38+ }
39+
3440 foreach ($ value ->getOrder ()->getAllItems () as $ orderItem ) {
3541 foreach ($ value ->getItems () as $ shipmentItem ) {
3642 if ($ orderItem ->getItemId () == $ shipmentItem ->getOrderItemId ()) {
@@ -53,4 +59,14 @@ public function getMessages(): array
5359 {
5460 return $ this ->messages ;
5561 }
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+ }
5672}
You can’t perform that action at this time.
0 commit comments