Skip to content

Commit 076bb60

Browse files
JosephMaxwelldmanners
authored andcommitted
#4942: bundled products now retain customer selections when editing from cart
1 parent c05ac4c commit 076bb60

File tree

1 file changed

+12
-0
lines changed
  • app/code/Magento/Bundle/Block/Catalog/Product/View/Type

1 file changed

+12
-0
lines changed

app/code/Magento/Bundle/Block/Catalog/Product/View/Type/Bundle.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,18 @@ public function getJsonConfig()
185185
if ($configValue) {
186186
$defaultValues[$optionId] = $configValue;
187187
}
188+
189+
190+
$preConfiguredQtys = $preConfiguredValues->getData("bundle_option_qty/${optionId}") ?? [];
191+
$selections = $options[$optionId]['selections'];
192+
array_walk($selections, function(&$selection, $selectionId) use ($preConfiguredQtys) {
193+
if (is_array($preConfiguredQtys) && isset($preConfiguredQtys[$selectionId])) {
194+
$selection['qty'] = $preConfiguredQtys[$selectionId];
195+
} else if ((int)$preConfiguredQtys > 0) {
196+
$selection['qty'] = $preConfiguredQtys;
197+
}
198+
});
199+
$options[$optionId]['selections'] = $selections;
188200
}
189201
$position++;
190202
}

0 commit comments

Comments
 (0)