47 if ($this->taxData->displayPriceIncludingTax()) {
49 $product = $this->registry->registry(
'current_product');
50 if (
$product->getTypeId() == \Magento\Catalog\Model\Product\Type::TYPE_BUNDLE) {
51 $priceConfigObj =
$observer->getData(
'configObj');
53 $priceConfig = $this->recurConfigAndUpdatePrice(
54 $priceConfigObj->getConfig(),
57 $priceConfigObj->setConfig($priceConfig);
58 }
catch (\Exception $e) {
73 private function recurConfigAndUpdatePrice($input, $searchKey)
76 if (is_array($input)) {
77 foreach ($input as $key => $el) {
80 $this->recurConfigAndUpdatePrice($el, $searchKey);
81 if ($key === $searchKey) {
82 if ((array_key_exists(
'basePrice', $holder[$key]))) {
83 if (array_key_exists(
'optionId', $input)) {
84 $holder = $this->updatePriceForBundle($holder, $key);
103 private function updatePriceForBundle($holder, $key)
105 if (array_key_exists($key, $holder)) {
106 if (array_key_exists(
'basePrice', $holder[$key])) {
108 $product = $this->registry->registry(
'current_product');
109 if (
$product->getTypeId() == \Magento\Catalog\Model\Product\Type::TYPE_BUNDLE) {
119 if ($holder[
'optionId'] == $selectionItem->getId()) {
126 $holder[$key][
'basePrice'][
'amount'] =
128 $holder[$key][
'oldPrice'][
'amount'] =
129 $oldAmount->getBaseAmount() + $oldAmount->getAdjustmentAmount(
'tax');
__construct(\Magento\Framework\Registry $registry, \Magento\Tax\Helper\Data $taxData)
execute(Observer $observer)