Skip to content

Commit 56b2932

Browse files
authored
ENGCOM-4359: Change product_price_value in cart data section based on tax settings #20316
2 parents 59f73d2 + 45c8aa7 commit 56b2932

File tree

1 file changed

+14
-0
lines changed
  • app/code/Magento/Tax/Plugin/Checkout/CustomerData

1 file changed

+14
-0
lines changed

app/code/Magento/Tax/Plugin/Checkout/CustomerData/Cart.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66

77
namespace Magento\Tax\Plugin\Checkout\CustomerData;
88

9+
/**
10+
* Process quote items price, considering tax configuration.
11+
* @SuppressWarnings(PHPMD.CookieAndSessionMisuse)
12+
*/
913
class Cart
1014
{
1115
/**
@@ -68,6 +72,16 @@ public function afterGetSectionData(\Magento\Checkout\CustomerData\Cart $subject
6872
$this->itemPriceRenderer->setItem($item);
6973
$this->itemPriceRenderer->setTemplate('checkout/cart/item/price/sidebar.phtml');
7074
$result['items'][$key]['product_price']=$this->itemPriceRenderer->toHtml();
75+
if ($this->itemPriceRenderer->displayPriceExclTax()) {
76+
$result['items'][$key]['product_price_value'] = $item->getCalculationPrice();
77+
} elseif ($this->itemPriceRenderer->displayPriceInclTax()) {
78+
$result['items'][$key]['product_price_value'] = $item->getPriceInclTax();
79+
} elseif ($this->itemPriceRenderer->displayBothPrices()) {
80+
//unset product price value in case price already has been set as scalar value.
81+
unset($result['items'][$key]['product_price_value']);
82+
$result['items'][$key]['product_price_value']['incl_tax'] = $item->getPriceInclTax();
83+
$result['items'][$key]['product_price_value']['excl_tax'] = $item->getCalculationPrice();
84+
}
7185
}
7286
}
7387
}

0 commit comments

Comments
 (0)