1

I want to display the price excluding tax of a single item in the cart. Therefore I need to edit the app/design/frontend/theme/theme/template/checkout/cart/item/default.phtml

How can I display the price of a single item? I tried <?php echo $item->getPrice();?> but that did not work.

2
  • Did you try $item->getProduct()->getPrice();? Feb 26 '17 at 18:17
  • @JaiminSutariya Thanks! I tried that, but that is displaying the price including tax. How can I display it excluding tax?
    – JGeer
    Feb 26 '17 at 22:03
3

You can deduct tax amount from product price and then display it on cart page.

$priceExcludingTax = ($_item->getPrice() * $this->getQty()) - ($_item->getTaxAmount() * $this->getQty());
6
  • Thanks! I tried that, but that does not seem to work. I get a php error, when trying to echo <?php echo $priceExcludingTax;?>
    – JGeer
    Feb 27 '17 at 7:27
  • What error you are getting? Feb 27 '17 at 7:29
  • Thanks, I needed to change $item to $_product. But that is still displaying the price including tax.
    – JGeer
    Feb 28 '17 at 10:27
  • Please check what values you get in $item->getPrice() and $item->getTaxAmount() Feb 28 '17 at 10:30
  • Thanks! I needed to change $item to $_item. But that is still not working. I want to price for 1 single item. When changing the value in the cart to two items, the price changes.
    – JGeer
    Feb 28 '17 at 10:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.