1234567891011121314151617181920212223242526272829303132333435363738 |
- <?php
- /**
- * Copyright © Magento, Inc. All rights reserved.
- * See COPYING.txt for license details.
- */
- namespace Magento\Bundle\Model\Plugin;
- use Magento\Quote\Model\Quote\Item\ToOrderItem;
- use Magento\Sales\Api\Data\OrderItemInterface;
- use Magento\Quote\Model\Quote\Item\AbstractItem;
- /**
- * Plugin for Magento\Quote\Model\Quote\Item\ToOrderItem
- */
- class QuoteItem
- {
- /**
- * Add bundle attributes to order data
- *
- * @param ToOrderItem $subject
- * @param OrderItemInterface $orderItem
- * @param AbstractItem $item
- * @param array $data
- * @return OrderItemInterface
- *
- * @SuppressWarnings(PHPMD.UnusedFormalParameter)
- */
- public function afterConvert(ToOrderItem $subject, OrderItemInterface $orderItem, AbstractItem $item, $data = [])
- {
- if ($attributes = $item->getProduct()->getCustomOption('bundle_selection_attributes')) {
- $productOptions = $orderItem->getProductOptions();
- $productOptions['bundle_selection_attributes'] = $attributes->getValue();
- $orderItem->setProductOptions($productOptions);
- }
- return $orderItem;
- }
- }
|