-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch '2.4-develop' of https://github.com/magento/magento2 int…
…o ASI-1750
- Loading branch information
Showing
272 changed files
with
10,918 additions
and
1,225 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
app/code/Magento/BundleGraphQl/Model/Order/Shipment/BundleShipmentItemFormatter.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace Magento\BundleGraphQl\Model\Order\Shipment; | ||
|
||
use Magento\Catalog\Model\Product\Type\AbstractType; | ||
use Magento\Sales\Api\Data\ShipmentInterface; | ||
use Magento\Sales\Api\Data\ShipmentItemInterface; | ||
use Magento\SalesGraphQl\Model\Shipment\Item\ShipmentItemFormatter; | ||
use Magento\SalesGraphQl\Model\Shipment\Item\FormatterInterface; | ||
|
||
/** | ||
* Format Bundle shipment items for GraphQl output | ||
*/ | ||
class BundleShipmentItemFormatter implements FormatterInterface | ||
{ | ||
/** | ||
* @var ShipmentItemFormatter | ||
*/ | ||
private $itemFormatter; | ||
|
||
/** | ||
* @param ShipmentItemFormatter $itemFormatter | ||
*/ | ||
public function __construct(ShipmentItemFormatter $itemFormatter) | ||
{ | ||
$this->itemFormatter = $itemFormatter; | ||
} | ||
|
||
/** | ||
* Format bundle product shipment item | ||
* | ||
* @param ShipmentInterface $shipment | ||
* @param ShipmentItemInterface $item | ||
* @return array|null | ||
*/ | ||
public function formatShipmentItem(ShipmentInterface $shipment, ShipmentItemInterface $item): ?array | ||
{ | ||
$orderItem = $item->getOrderItem(); | ||
$shippingType = $orderItem->getProductOptions()['shipment_type'] ?? null; | ||
if ($shippingType == AbstractType::SHIPMENT_SEPARATELY && !$orderItem->getParentItemId()) { | ||
//When bundle items are shipped separately the children are treated as their own items | ||
return null; | ||
} | ||
return $this->itemFormatter->formatShipmentItem($shipment, $item); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.