Configuring Price Rounding Rules in 1C-Bitrix
Price rounding in 1C-Bitrix is the point where a mathematically correct result is perceived as an artifact. A 7% discount on a product priced at 349 gives 324.57. Displaying such a price in a storefront is undesirable. Bitrix addresses this through rounding rules in the catalog module.
Where Rounding Is Configured
"Settings → Product Settings → Catalog → Price Rounding". In earlier versions — in the settings of the bitrix:catalog.element and bitrix:catalog.section components, with separate parameters PRICE_VAT_INCLUDE and individual rounding settings.
Global rounding rules — CCatalogProduct::getRoundRules() reads from b_catalog_rounding_rule.
Types of Rounding Rules
| Rule | Description | Example |
|---|---|---|
| Mathematical | Standard: 0.5 → round up | 324.57 → 325 |
| Always down | floor() |
324.57 → 324 |
| Always up | ceil() |
324.01 → 325 |
| To required precision | Precision set in settings | 324.57 → 320 or 324.6 |
Programmatic Rule Configuration
// Adding a rounding rule
\Bitrix\Catalog\RoundingTable::add([
'CATALOG_GROUP_ID' => $priceTypeId, // 0 = all price types
'PRICE_FROM' => 0,
'PRICE_TO' => 999.99,
'ROUND_TYPE' => \Bitrix\Catalog\RoundingTable::ROUND_MATH,
'ROUND_PRECISION' => 0, // round to whole numbers
]);
// For prices from 1000 — a different rule
\Bitrix\Catalog\RoundingTable::add([
'CATALOG_GROUP_ID' => $priceTypeId,
'PRICE_FROM' => 1000,
'PRICE_TO' => null,
'ROUND_TYPE' => \Bitrix\Catalog\RoundingTable::ROUND_MATH,
'ROUND_PRECISION' => -1, // round to tens
]);
ROUND_PRECISION — number of decimal places (negative values round to tens, hundreds).
Rounding in Cart and Storefront
Rounding rules are applied when computing the final price via CCatalogProduct::GetOptimalPrice(). In the cart component — when recalculating the line total. Important: VAT is added after rounding the base price, not before.
Psychological Pricing
For prices ending in ".99", rounding rules are not suitable — this is a marketing task solved by a post-processing handler. For example, an OnSaleOrderBeforeSaved event handler or a custom price recalculation method.
Timeline
Configuring rounding rules for all price types — 1–3 hours. Custom logic (psychological pricing, different rules for categories) — 4–8 hours.







