Skip to content

Commit 13c66f3

Browse files
committed
Do not show attribtues for disabled products
1 parent b04703b commit 13c66f3

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/Form/Type/ChoiceMapper/ProductAttributesMapper.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,14 @@ public function mapToChoices(ProductAttributeInterface $productAttribute): array
5858
$attributeValues = $this->productAttributeValueRepository->findBy(['attribute' => $productAttribute]);
5959
$choices = [];
6060
array_walk($attributeValues, function (ProductAttributeValueInterface $productAttributeValue) use (&$choices): void {
61+
$product = $productAttributeValue->getProduct();
62+
63+
if (!$product->isEnabled()) {
64+
return;
65+
}
66+
6167
$value = $productAttributeValue->getValue();
6268
$configuration = $productAttributeValue->getAttribute()->getConfiguration();
63-
$product = $productAttributeValue->getProduct();
6469

6570
if (is_array($value)
6671
&& isset($configuration['choices'])

0 commit comments

Comments
 (0)