Skip to content

Commit 67e406d

Browse files
committed
MC-42831: [Magento Cloud] Continuation from previous JIRA - "Add configured_variant to ConfigurableCartItem There is a PR and an MC"
1 parent 17371a7 commit 67e406d

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

app/code/Magento/QuoteGraphQl/Plugin/ProductAttributesExtender.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,12 @@
88
namespace Magento\QuoteGraphQl\Plugin;
99

1010
use Magento\Catalog\Model\ResourceModel\Product\Attribute\CollectionFactory as AttributeCollectionFactory;
11-
use Magento\Eav\Api\Data\AttributeInterface;
1211
use Magento\Framework\GraphQl\Query\Fields;
1312
use Magento\Quote\Model\Quote\Config as QuoteConfig;
1413

14+
/**
15+
* Class for extending product attributes for quote.
16+
*/
1517
class ProductAttributesExtender
1618
{
1719
/**
@@ -37,6 +39,8 @@ public function __construct(
3739
}
3840

3941
/**
42+
* Add requested product attributes.
43+
*
4044
* @param QuoteConfig $subject
4145
* @param array $result
4246
* @return array
@@ -46,11 +50,11 @@ public function afterGetProductAttributes(QuoteConfig $subject, array $result):
4650
{
4751
$attributeCollection = $this->attributeCollectionFactory->create()
4852
->removeAllFieldsFromSelect()
49-
->addFieldToSelect(AttributeInterface::ATTRIBUTE_CODE)
53+
->addFieldToSelect('attribute_code')
5054
->setCodeFilter($this->fields->getFieldsUsedInQuery())
5155
->load();
52-
$attributes = $attributeCollection->getColumnValues(AttributeInterface::ATTRIBUTE_CODE);
56+
$attributes = $attributeCollection->getColumnValues('attribute_code');
5357

54-
return array_merge($result, $attributes);
58+
return array_unique(array_merge($result, $attributes));
5559
}
5660
}

0 commit comments

Comments
 (0)