Skip to main content
deleted 118 characters in body
Source Link
Aasim Goriya
  • 5.5k
  • 2
  • 28
  • 53

By default of Magento 2, price format is a little strange for some currencies so we need to change it. Here’s the way to change price format.

Here’s the example for the case of Vietnamese dong. Default displayed format was 100.000,00. Then I changed it into 100,000 (separated by comma without decimal point).

# vendor/magento/zendframework1/library/Zend/Locale/Data/vi.xml
<symbols numbersystem="latn">
 <decimal>.</decimal>
 <group>,</group>
</symbols>

# vendor/magento/framework/Pricing/PriceCurrencyInterface.php
const DEFAULT_PRECISION = 0

# vendor/magento/module-directory/Model/Currency.php
return $this->formatPrecision($price, 0, $options, $includeContainer, $addBrackets);

# vendor/magento/module-sales/Model/Order.php
public function formatPrice($price, $addBrackets = false)
{
    return $this->formatPricePrecision($price, 0, $addBrackets);
}

Also check here for more info

Thanks Enjoy :)

By default of Magento 2, price format is a little strange for some currencies so we need to change it. Here’s the way to change price format.

Here’s the example for the case of Vietnamese dong. Default displayed format was 100.000,00. Then I changed it into 100,000 (separated by comma without decimal point).

# vendor/magento/zendframework1/library/Zend/Locale/Data/vi.xml
<symbols numbersystem="latn">
 <decimal>.</decimal>
 <group>,</group>
</symbols>

# vendor/magento/framework/Pricing/PriceCurrencyInterface.php
const DEFAULT_PRECISION = 0

# vendor/magento/module-directory/Model/Currency.php
return $this->formatPrecision($price, 0, $options, $includeContainer, $addBrackets);

# vendor/magento/module-sales/Model/Order.php
public function formatPrice($price, $addBrackets = false)
{
    return $this->formatPricePrecision($price, 0, $addBrackets);
}

Also check here for more info

Thanks Enjoy :)

By default of Magento 2, price format is a little strange for some currencies so we need to change it. Here’s the way to change price format.

Here’s the example for the case of Vietnamese dong. Default displayed format was 100.000,00. Then I changed it into 100,000 (separated by comma without decimal point).

# vendor/magento/zendframework1/library/Zend/Locale/Data/vi.xml
<symbols numbersystem="latn">
 <decimal>.</decimal>
 <group>,</group>
</symbols>

# vendor/magento/framework/Pricing/PriceCurrencyInterface.php
const DEFAULT_PRECISION = 0

# vendor/magento/module-directory/Model/Currency.php
return $this->formatPrecision($price, 0, $options, $includeContainer, $addBrackets);

# vendor/magento/module-sales/Model/Order.php
public function formatPrice($price, $addBrackets = false)
{
    return $this->formatPricePrecision($price, 0, $addBrackets);
}

Thanks Enjoy :)

Source Link
Aasim Goriya
  • 5.5k
  • 2
  • 28
  • 53

By default of Magento 2, price format is a little strange for some currencies so we need to change it. Here’s the way to change price format.

Here’s the example for the case of Vietnamese dong. Default displayed format was 100.000,00. Then I changed it into 100,000 (separated by comma without decimal point).

# vendor/magento/zendframework1/library/Zend/Locale/Data/vi.xml
<symbols numbersystem="latn">
 <decimal>.</decimal>
 <group>,</group>
</symbols>

# vendor/magento/framework/Pricing/PriceCurrencyInterface.php
const DEFAULT_PRECISION = 0

# vendor/magento/module-directory/Model/Currency.php
return $this->formatPrecision($price, 0, $options, $includeContainer, $addBrackets);

# vendor/magento/module-sales/Model/Order.php
public function formatPrice($price, $addBrackets = false)
{
    return $this->formatPricePrecision($price, 0, $addBrackets);
}

Also check here for more info

Thanks Enjoy :)