how to remove only ".00" decimal from price in magento2?
For Example,
$500.00 => $500
$19.99 => $19.99
Any help will be appreciated.
Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It only takes a minute to sign up.
Sign up to join this communityhow to remove only ".00" decimal from price in magento2?
For Example,
$500.00 => $500
$19.99 => $19.99
Any help will be appreciated.
You can find from below github link for price decimal setting in magento 2,
Price Decimal Setting for Magento 2
After installing extension in your site you need to just set configuration from Stores -> Configuration.
.00
.
Oct 17, 2018 at 22:30
You need overwrite the method getPriceFormat of the class Format.
<preference for="Magento\Framework\Locale\Format" type="My\MODULE\Model\Format" />
In your class format
public function getPriceFormat($localeCode = null, $currencyCode = null)
{
.
.
$result = [
//TODO: change interface
'pattern' => $currency->getOutputFormat(),
'precision' => 0,
'requiredPrecision' => 0,
'decimalSymbol' => $decimalSymbol,
'groupSymbol' => $groupSymbol,
'groupLength' => $group,
'integerRequired' => $integerRequired,
];
}
result 3,858 before 3,858.00