File tree Expand file tree Collapse file tree 1 file changed +22
-1
lines changed
app/code/Magento/Bundle/Model/Product Expand file tree Collapse file tree 1 file changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -665,7 +665,11 @@ protected function _prepareProduct(\Magento\Framework\DataObject $buyRequest, $p
665665 $ skipSaleableCheck = $ this ->_catalogProduct ->getSkipSaleableCheck ();
666666 $ _appendAllSelections = (bool )$ product ->getSkipCheckRequiredOption () || $ skipSaleableCheck ;
667667
668- $ options = $ buyRequest ->getBundleOption ();
668+ if ($ buyRequest ->getBundleOptionsData ()) {
669+ $ options = $ this ->getPreparedOptions ($ buyRequest ->getBundleOptionsData ());
670+ } else {
671+ $ options = $ buyRequest ->getBundleOption ();
672+ }
669673 if (is_array ($ options )) {
670674 $ options = $ this ->recursiveIntval ($ options );
671675 $ optionIds = array_keys ($ options );
@@ -1413,4 +1417,21 @@ protected function mergeSelectionsWithOptions($options, $selections)
14131417
14141418 return array_merge ([], ...$ selections );
14151419 }
1420+
1421+ /**
1422+ * Get prepared options with selection ids
1423+ *
1424+ * @param array $options
1425+ * @return array
1426+ */
1427+ private function getPreparedOptions (array $ options ): array
1428+ {
1429+ foreach ($ options as $ optionId => $ option ) {
1430+ foreach ($ option as $ selectionId => $ optionQty ) {
1431+ $ options [$ optionId ][$ selectionId ] = $ selectionId ;
1432+ }
1433+ }
1434+
1435+ return $ options ;
1436+ }
14161437}
You can’t perform that action at this time.
0 commit comments