- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2019
05:56 AM
06-17-2019
05:56 AM
How can i remove ".00" (decimal place) from price range filter on layered navigation ?
Magento Version : 2.3.0
According to my client requirement, need to remove ".00" decimal places from price range filter on category page layered navigation.
For that please see screenshot :
Please suggest me, how can i achieve it ?
Labels:
4 REPLIES 4
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2019
06:51 AM
06-17-2019
06:51 AM
Re: How can i remove ".00" (decimal place) from price range filter on layered navigation ?
Hello @yagnik_solanki
Please try the below solution:
- Create di.xml at app/code/YourNamespace/YourModule/etc/
<?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> <preference for="Magento\Framework\Pricing\PriceCurrencyInterface" type="YourNamespace\YourModule\Model\PriceCurrency" /> </config>
- Create PriceCurrency.php at app/code/YourNamespace/YourModule/Model/
<?php namespace YourNamespace\YourModule\Model; use Magento\Framework\Pricing\PriceCurrencyInterface; class PriceCurrency extends \Magento\Directory\Model\PriceCurrency implements PriceCurrencyInterface { /** * @inheritdoc */ const PRECISION_ZERO = 0; /** * {@inheritdoc} */ public function format( $amount, $includeContainer = true, $precision = self::PRECISION_ZERO, $scope = null, $currency = null ) { return $this->getCurrency($scope, $currency) ->formatPrecision($amount, $precision, [], $includeContainer); } }
Source: Magento 2: how to remove decimal values from layered navigation
Hope it helps.
---
If you've found my answer useful, please give"Kudos" and "Accept as Solution"
If you've found my answer useful, please give"Kudos" and "Accept as Solution"
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2019
08:56 PM
06-17-2019
08:56 PM
Re: How can i remove ".00" (decimal place) from price range filter on layered navigation ?
Thanks for reply,
I already tried this type of solution but i need to only for layered
navigation price range filter not for whole site.
can you have any other solution for this?
I already tried this type of solution but i need to only for layered
navigation price range filter not for whole site.
can you have any other solution for this?
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2019
09:52 PM
06-17-2019
09:52 PM
Re: How can i remove ".00" (decimal place) from price range filter on layered navigation ?
Please try the below solution:
Open the file:
vendor/magento/module-layered-navigation/view/frontend/templates/layer/filter.phtml
At line 23, you'll find:
<?= /* @escapeNotVerified */ $filterItem->getLabel() ?>
Replace it with:
<?php echo str_replace(".00","",$filterItem->getLabel()); ?>
Implement the above steps and you'll get the solution.
---
If you've found my answer useful, please give"Kudos" and "Accept as Solution"
If you've found my answer useful, please give"Kudos" and "Accept as Solution"
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2019
10:00 PM
06-17-2019
10:00 PM
Re: How can i remove ".00" (decimal place) from price range filter on layered navigation ?
Thanks for reply,
I have fixed issue my way.
I have fixed issue my way.