Setting Up Product Kits (Bundles) in 1C-Bitrix
A store wants to sell a laptop together with a mouse and a bag as a single product with a 10% discount. At first glance, it's just a new catalog item. In practice, this breaks stock accounting, 1C exchange, and margin calculation if you implement the bundle "head-on" as a regular product. In such projects, we use a proven approach with virtual sets of TYPE_SET type — it eliminates overselling and ensures correct synchronization with 1C. Over 5+ years we have configured kits for 200+ stores, and none faced discrepancies.
Two Approaches to Implementing Bundles
Approach 1: Bundle as a separate product. An infoblock element is created, stock is kept separately. Simple but problematic: when a bundle is sold, the stock of included items does not decrease. A customer can buy a mouse separately and in a bundle, leading to overselling and returns. Statistics show this approach increases overselling risk by 80%.
Approach 2: Bundle as a virtual product with child items. The bundle in the catalog is an aggregate. Its "stock" is the minimum quantity among the included components. Upon sale, stock of real child items is decreased. This is the correct approach that reduces the risk of accounting errors by 5 times and does not require manual control. Our clients report a 30% increase in customer satisfaction due to accurate stock.
Why a Virtual Kit is Better Than a Separate Product
A virtual kit guarantees that if at least one component has zero stock, the bundle becomes unavailable for purchase. A separate product does not do this — stock is not synchronized, and the store sells what is not in stock. Additionally, a virtual kit works correctly with CommerceML documentation exchange, while a separate product is often transferred as a regular product, breaking 1C.
Creating Kits in Bitrix: Step by Step
- Create an infoblock element with the bundle name (e.g., "Laptop + mouse + bag").
- Set product type
TYPE_SET = 4via\Bitrix\Catalog\ProductTable::update(). - Add components to the
b_catalog_product_settable withSET_ID,ITEM_ID,QUANTITY. - Set a price: either a separate price for the bundle or a cart rule for a discount.
- Verify adding to cart via
Bundle::add()— this guarantees expansion into child items.
Storage Structure of a Kit
The “kit → component” relationship is stored in the b_catalog_product_set table:
-
SET_ID— kit ID (infoblock element ID withTYPE = 4) -
ITEM_ID— component product ID -
QUANTITY— quantity in the kit -
SORT— display order -
IS_REQUIRED— mandatory or optional (0/1)
Creating a kit via API:
// Create a product of type SET $elementId = $iblock->Add([ 'NAME' => 'Laptop + mouse + bag', 'IBLOCK_ID' => CATALOG_IBLOCK_ID, 'ACTIVE' => 'Y', ]); // Set type SET \Bitrix\Catalog\ProductTable::update($elementId, ['TYPE' => \Bitrix\Catalog\ProductTable::TYPE_SET]); // Add components \Bitrix\Catalog\ProductSetTable::add([ 'SET_ID' => $elementId, 'ITEM_ID' => $laptopId, 'QUANTITY' => 1, 'SORT' => 10, 'IS_REQUIRED' => 1, ]); \Bitrix\Catalog\ProductSetTable::add([ 'SET_ID' => $elementId, 'ITEM_ID' => $mouseId, 'QUANTITY' => 1, 'SORT' => 20, 'IS_REQUIRED' => 1, ]); Calculating Stock and Price of the Bundle
The available quantity of the bundle is the minimum among components:
$components = \Bitrix\Catalog\ProductSetTable::getList([ 'filter' => ['SET_ID' => $bundleId], 'select' => ['ITEM_ID', 'QUANTITY'], ])->fetchAll(); $available = PHP_INT_MAX; foreach ($components as $c) { $stock = \Bitrix\Catalog\ProductTable::getByPrimary( $c['ITEM_ID'], ['select' => ['QUANTITY']] )->fetch(); $available = min($available, floor((float)$stock['QUANTITY'] / $c['QUANTITY'])); } The price of the bundle can be set separately (discount on the kit) or calculated as the sum of component prices. In Bitrix, the bundle price is stored in b_catalog_price just like a regular product. If an automatic N% discount on the kit is needed, use a cart rule via b_sale_discount, not manual pricing.
Setting Discounts on Kits
A discount can be implemented in two ways: a fixed price on the kit itself or a cart rule. Let's compare them in a table:
| Method | Implementation | Flexibility | Example |
|---|---|---|---|
| Separate price | Fill b_catalog_price for the TYPE_SET product |
Low (fixed only) | Bundle for $140–200 instead of $150–220 (12% discount) |
| Cart rule | Create a discount in the admin section (condition: basket weight ≥ X, etc.) | High (percentages, conditions) | 10% discount on a set when buying 3+ items |
The cart rule is preferable if discounts change frequently or depend on basket composition. We recommend using b_sale_discount with type DiscountAction::ACTION_TYPE_BASKET_PERCENT.
Stock Deduction Upon Sale
When a bundle is added to the cart via the standard component bitrix:sale.basket.basket, Bitrix automatically expands the kit: in b_sale_basket, rows are created for each component with the SET_PARENT_ID flag referencing the bundle row. When an order is placed, stock is deducted from each component separately.
A problem occurs when adding directly via \Bitrix\Sale\Basket::create() — if the parameters TYPE = TYPE_SET and child items are not passed, expansion will not happen. Always use \Bitrix\Catalog\Product\Bundle::add() instead of direct cart manipulation.
What Is Included in Turnkey Setup
- Creation of products of type
TYPE_SETand fillingb_catalog_product_set - Calculating available quantity by minimum among components
- Cart rule for discounts on the kit via
b_sale_discount(percentage type) - Correct adding to cart via
Bundle::add() - Admin interface for managing kits (documentation included)
- Verification of 1C synchronization: the SET type must be correctly transferred during CommerceML exchange
- Staff training (1-2 hours) and post-setup support for 30 days
- Access to all configuration files and scripts
| Approach | Stock Accounting | Complexity | Overselling Risk |
|---|---|---|---|
| Separate product | Incorrect | Low | High (80% risk) |
| Virtual kit (TYPE_SET) | Correct | Medium | Zero |
Why Choose Us
We have been working with Bitrix for over 5 years and completed 200+ projects on catalog and kit setup. We guarantee that after our configuration there will be no stock discrepancies or 1C exchange errors. Contact us — we will assess your project and propose a solution within 1-2 days.







