Skip to content

Commit f889095

Browse files
committed
ACP2E-1799: 'Qty Uses Decimal' cannot be used for a Bundle product option
1 parent fb172b3 commit f889095

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

app/code/Magento/Bundle/Ui/DataProvider/Product/Form/Modifier/AddSelectionQtyTypeToProductsData.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,13 @@ class AddSelectionQtyTypeToProductsData implements ModifierInterface
2424
private StockRegistryPreloader $stockRegistryPreloader;
2525

2626
/**
27-
* Construct
27+
* Initializes dependencies
2828
*
29+
* @param StockRegistryPreloader $stockRegistryPreloader
2930
*/
30-
public function __construct()
31+
public function __construct(StockRegistryPreloader $stockRegistryPreloader)
3132
{
32-
$this->stockRegistryPreloader = ObjectManager::getInstance()->get(StockRegistryPreloader::class);
33+
$this->stockRegistryPreloader = $stockRegistryPreloader;
3334
}
3435

3536
/**
@@ -63,10 +64,10 @@ public function modifyData(array $data): array
6364
foreach ($stockItems as $stockItem) {
6465
$isQtyDecimals[$stockItem->getProductId()] = $stockItem->getIsQtyDecimal();
6566
}
66-
67+
6768
foreach ($data['items'] as &$item) {
68-
if ($isQtyDecimals[$item['entity_id']]) {
69-
$item['selection_qty_is_integer'] = false;
69+
if (isset($isQtyDecimals[$item['entity_id']])) {
70+
$item['selection_qty_is_integer'] = !$isQtyDecimals[$item['entity_id']];
7071
}
7172
}
7273

0 commit comments

Comments
 (0)