Setting up rules for working with the 1C-Bitrix shopping cart

Our company is engaged in the development, support and maintenance of Bitrix and Bitrix24 solutions of any complexity. From simple one-page sites to complex online stores, CRM systems with 1C and telephony integration. The experience of developers is confirmed by certificates from the vendor.
Our competencies:
Development stages
Latest works
  • image_website-b2b-advance_0.png
    B2B ADVANCE company website development
    1173
  • image_bitrix-bitrix-24-1c_fixper_448_0.png
    Website development for FIXPER company
    811
  • image_bitrix-bitrix-24-1c_development_of_an_online_appointment_booking_widget_for_a_medical_center_594_0.webp
    Development based on Bitrix, Bitrix24, 1C for the company Development of an Online Appointment Booking Widget for a Medical Center
    564
  • image_bitrix-bitrix-24-1c_mirsanbel_458_0.webp
    Development based on 1C Enterprise for MIRSANBEL
    745
  • image_crm_dolbimby_434_0.webp
    Website development on CRM Bitrix24 for DOLBIMBY
    655
  • image_crm_technotorgcomplex_453_0.webp
    Development based on Bitrix24 for the company TECHNOTORGKOMPLEKS
    976

Configuring Cart Rules in 1C-Bitrix

Cart rules are an advanced mechanism that governs not only discounts but also cart behaviour: minimum/maximum order amounts, quantity limits for specific products, restrictions on adding competing items, and mandatory companion products. This is a layer built on top of the basic cart rules in the sale module, enabling business logic that standard discounts cannot handle.

Amount and Quantity Limits

Minimum order amount. Configured in site settings: Settings → Main Module Settings → Minimum Order Amount. This is a global setting. To enforce a minimum amount per user group or for a specific catalog section, a cart rule is required with a condition and the action "Prohibit order placement".

Event handler for programmatic enforcement:

AddEventHandler('sale', 'OnSaleComponentOrderOneStepProcess', function(&$arParams, &$arResult) {
    $basket = $arResult['BASKET_ITEMS'];
    $total = array_sum(array_column($basket, 'PRICE'));

    if ($total < 1000) {
        $arResult['ERROR_MESSAGE'] = 'Minimum order amount is 1000 roubles';
        $arResult['ERROR'] = 'Y';
    }
});

Per-customer quantity limit. A promotional product that cannot be purchased more than 2 units per order, or more than 5 units over all time. The second case requires a query against b_sale_basket or the user's order history — it can only be implemented through an event handler.

Rules for B2B Segments

In B2B stores, cart rules operate with user groups. Typical tasks:

  • Wholesale thresholds: when quantity ≥ 10 units, the price drops to wholesale. Implemented via a cart rule with a quantity condition and the action "Discount on product" tied to a specific product code or section.
  • Supplier mixing restriction: only products from a single supplier may be in the cart. Adding a second supplier triggers a warning or auto-clear. Implemented via the OnSaleBasketItemOnBeforeSetField handler.
  • Mandatory minimum assortment: when placing an order, a distributor manager must include at least 3 SKUs from a category. Validation fires when attempting to proceed to checkout.

Companion and Mandatory Products

The rule "add a companion product" (e.g., a charger alongside a phone) works via the action "Add gift/companion product". The difference between a gift (price 0) and a companion product (full price) lies in the rule action.

Mandatory products — such as insurance when purchasing electronics — require custom logic. 1C-Bitrix has no built-in "mandatory product" mechanism in the cart. It is implemented through an event handler that blocks checkout when the required item is absent.

Testing Rules

After configuration, each rule must be verified across several scenarios: the rule applies when it should, does not apply when it should not, and is correctly removed when the cart changes. Pay special attention to rule combinations: two rules together must not produce unexpected results (e.g., a 110% discount).

Configuration Timeline

Configuring cart rules through the administrative interface takes half a day to 2 days depending on the number of rules and their complexity. Developing non-standard restrictions through event handlers takes 1–3 days, including testing all scenarios.