As a Magento agency focused on online shop development for demanding B2B and specialized applications, we at Econcess regularly develop custom extensions for Magento 2. In this article, we present a practical solution for a common requirement: entering and processing prices with four decimal places in the Magento backend.
Why Four Decimal Places?
Magento rounds prices to two decimal places by default. This is sufficient for many B2C shops, but not for specialized industries such as:
- E-liquids
- Chemicals
- Raw materials
- Products sold by weight (e.g. in metal processing)
Especially in the B2B sector, precise pricing is often essential, for example for individual tier prices or precisely calculated discounts.
Problem: Magento Internally Rounds to 2 Decimal Places
When creating orders in the admin area (Sales > Orders > Create), it may initially appear that more decimal places are allowed. In fact, the input field sometimes accepts three or more decimal places – but when the order is saved, these are internally ignored or rounded.

Solution: Module + Template Customization
With a small plugin and a template customization, you can easily extend Magento to support four decimal places. The key is to take both backend logic and the display in the admin area into account.
1. Backend Logic: Plugin for Quote\Item::setCustomPrice
namespace Econcess\PrecisePriceRounding\Plugin;
use Magento\Quote\Model\Quote\Item;
class QuoteItemPricePrecisionPlugin
{
public function beforeSetCustomPrice(Item $subject, $price)
{
return [round($price, 4)];
}
}
➡️ This plugin ensures that the entered value is not truncated to two decimal places, but instead retains its full precision.
2. Admin Display: Customize grid.phtml
The input field for custom prices is rendered by default as follows:
<input value="<?= sprintf("%.2f", $block->getOriginalEditablePrice($_item)) ?>" />
The output needs to be extended to four decimal places:
<input value="<?= sprintf("%.4f", $block->getOriginalEditablePrice($_item)) ?>" />

Test & Result
- ✅ Enter values such as
12.3456 - ✅ Save without losing precision
- ✅ Discounts and totals remain consistent

Conclusion
With a manageable amount of effort, Magento can be customized to meet specific requirements – cleanly and in an update-safe manner. This is particularly valuable for web agencies or Magento agencies managing complex B2B shops.
Need Magento Customization?
Whether you need custom backend functionality or tailored pricing logic: As an experienced Magento internet agency, we advise and support you in the further development of your online shop.
👉 Contact us – we would be happy to help.
