How to Hide Decimals in Product and Listing Views

  • Posts: 85
  • Thank you received: 14
  • Hikashop Business
1 day 9 hours ago #367552

Hi,
We need to edit the price display (views) to hide the decimals of the price (tax included) in both the product view and the product listing view.
This change should not affect the cart view, where the decimals should still be displayed as shown in the attached image.

Below, we've attached to illustrate the key points:
Product Listing: Shows how we want the price to appear without decimals.
Shopping Cart: Shows how the price with decimals should remain visible.

Thank you
Javier


Javier Ballester
Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 83935
  • Thank you received: 13593
  • MODERATOR
1 day 6 hours ago #367553

Hi,

Edit the view file product / listing_price via the menu Display>Views.
There, change the line:

echo $this->currencyHelper->format(@$price->price_value_with_tax, $price->price_currency_id);
to:
echo round(@$price->price_value_with_tax) . ' €';
Note that this assumes that you're only display the prices with the euro currency. If you need to handle several currencies, then, you have to load the currency data from the database based on $price->price_currency_id so that you can display the currency symbol dynamically.

The following user(s) said Thank You: Jabatec

Please Log in or Create an account to join the conversation.

Time to create page: 0.036 seconds
Powered by Kunena Forum