Setting Up VAT Accounting in 1C-Bitrix
Online store shows price with VAT, invoice is generated without VAT, and 1C receives a third amount — this all indicates that VAT is configured in three different places without a single source of truth.
Where VAT rates are stored
VAT rates in Bitrix are records in b_catalog_vat. Each record: ID, NAME (e.g., "VAT 20%"), RATE (number, 20), ACTIVE. Binding rate to product — field VAT_ID in b_iblock_element_property or directly in b_catalog_product via VAT_ID field.
VAT inclusion in price is managed by VAT_INCLUDED field in b_catalog_product: Y — price includes VAT, N — VAT on top. This field is often ignored during setup, and then system calculates VAT twice or not at all.
Getting rate for product:
$product = \Bitrix\Catalog\ProductTable::getById($productId)->fetch();
$vat = \Bitrix\Catalog\VatTable::getById($product['VAT_ID'])->fetch();
// $vat['RATE'] — numeric rate value
// $product['VAT_INCLUDED'] — is VAT included in price
VAT display in basket and order
The bitrix:sale.basket.basket component displays VAT if SHOW_VAT is enabled in parameters. But even with parameter enabled, VAT sum might be calculated incorrectly — this happens when some products have VAT_INCLUDED = Y and some have N.
Correct VAT sum calculation for basket item:
// VAT_INCLUDED = Y: VAT = PRICE * RATE / (100 + RATE)
// VAT_INCLUDED = N: VAT = PRICE * RATE / 100
Bitrix stores final VAT sum per item in b_sale_basket — field VAT_RATE (rate) and VAT_SUM (amount). When order is created, these values are copied to b_sale_order_basket.
Tax exceptions and 0%
For products exempt from VAT, create separate rate with RATE = 0 in b_catalog_vat. This is important: don't leave VAT_ID = NULL, explicitly specify zero rate. With NULL different Bitrix versions behave differently — some apply store default rate, others skip VAT entirely.
Store default rate is set in b_option, module sale, parameter default_vat_rate. This is what's used as fallback.
Invoice and print forms
Standard invoice print form in Bitrix (/bitrix/modules/sale/lang/en/documents/) takes data from b_sale_order and related tables. VAT in invoice displays correctly only if order has filled VAT_RATE and VAT_SUM for each position.
For custom print forms (PDF via mpdf or tcpdf), calculate sums explicitly:
$basket = \Bitrix\Sale\Basket::loadItemsForOrder($order);
$totalVat = 0;
foreach ($basket as $item) {
$totalVat += $item->getField('VAT_SUM') * $item->getQuantity();
}
Transferring VAT to 1C
When exporting orders to 1C via CommerceML (sale.crm.order), VAT is transmitted in element <PricePerUnit> with attribute PriceIncludesVAT and separate <Tax> element. If 1C amounts differ from website, first thing to check — correspondence of VAT_INCLUDED in Bitrix and nomenclature settings in 1C. Second source of discrepancies — rounding: Bitrix rounds to 2 decimal places per item, 1C might calculate total for entire order, giving difference in cents.







