Separate Carts for Multi-Site 1C-Bitrix

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.
Showing 1 of 1All 1626 services
Separate Carts for Multi-Site 1C-Bitrix
Simple
~1 day
Frequently Asked Questions

Our competencies:

Development stages

Latest works

  • image_website-b2b-advance_0.webp
    B2B ADVANCE company website development
    1362
  • image_bitrix-bitrix-24-1c_fixper_448_0.webp
    Website development for FIXPER company
    949
  • 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
    695
  • image_bitrix-bitrix-24-1c_mirsanbel_458_0.webp
    Development based on 1C Enterprise for MIRSANBEL
    834
  • image_crm_dolbimby_434_0.webp
    Website development on CRM Bitrix24 for DOLBIMBY
    733
  • image_crm_technotorgcomplex_453_0.webp
    Development based on Bitrix24 for the company TECHNOTORGKOMPLEKS
    1076

Separate Carts for Multi-Site 1C-Bitrix

We've encountered multi-site projects where retail and wholesale sites share a common catalog. The problem: by default, Bitrix's shopping cart is tied to the user, not the site. A customer adds items on the retail site, switches to wholesale, and sees the same cart. This is unacceptable when prices, delivery, and client type differ. In practice, this breaks reporting and confuses managers. With over 10 years of experience and 40+ multi-site projects completed, we've set up separate carts reliably. Here's how it's done, with typical costs starting at $500.

Why Does the Cart Become Shared?

The cart is stored in the b_sale_basket table. Key fields:

SELECT id, fuser_id, site_id, product_id, quantity, price, currency
FROM b_sale_basket
WHERE fuser_id = 12345;

There is a SITE_ID field in the cart, and Bitrix uses it. The problem is that fuser_id (fusion user — anonymous user) is tied to the cookie BITRIX_SM_FUSER_ID, which is common across all subdomains unless configured otherwise. Quoting from the documentation: “The cart is attached to the fuser_id, which can be the same for different sites if they share the session domain.” This leads to mixing items.

Choosing a Separation Method

Method Complexity Isolation When to Use
Different domains Low 100% Possible to host sites on different domains
Pass SITE_ID to component Medium 90% Single domain, quick setup without coding
OnBeforeBasketItemAdd event High 99% Single domain, strong binding required

Method 1: Separate Domains Without Shared Cookies

The most reliable way, offering 100% isolation. If sites run on different domains (retail.shop.ru and wholesale.shop.ru) or different second-level domains, the fuser_id cookie is not passed automatically. Bitrix creates separate carts out of the box. This approach is best suited for separation: it eliminates influence from the adjacent site completely.

Check current configuration:

// /bitrix/php_interface/dbconn.php or .settings.php
// Check SESSION_DOMAIN — if same for all sites, problem exists
$_SESSION['BITRIX_SM_FUSER_ID']; // Same for all sites

Method 2: Explicit SITE_ID Passed to Cart Component

The bitrix:sale.basket.basket component accepts a SITE_ID parameter. Ensure it is passed correctly:

$APPLICATION->IncludeComponent('bitrix:sale.basket.basket', '.default', [
    'SITE_ID' => SITE_ID, // Current site ID
    'PRICE_VAT_SHOW_VALUE' => 'Y',
    // ...
]);

Method 3: Programmatic Separation via Event

If the architecture does not allow domain separation, subscribe to the OnBeforeBasketItemAdd event and forcibly set SITE_ID:

// /local/php_interface/init.php
AddEventHandler('sale', 'OnBeforeBasketItemAdd', 'SetBasketSiteId');

function SetBasketSiteId(&$arFields) {
    $currentSite = \Bitrix\Main\Context::getCurrent()->getSite();
    $arFields['SITE_ID'] = $currentSite;
    return true;
}

The OnBeforeBasketItemAdd event is the entry point before data is written. We change SITE_ID to the current one before writing. This guarantees that the cart is tied to the site where the purchase is made.

Correctly Counting Items in the Cart

The cart counter in the header is a typical place where separate carts break visually: it shows the total quantity across all sites. Fix by explicitly filtering:

use Bitrix\Sale\Basket;
use Bitrix\Main\Context;

$basket = Basket::loadItemsForFUser(
    \CSaleBasket::GetBasketUserID(),
    Context::getCurrent()->getSite() // Pass current SITE_ID
);
$itemCount = $basket->count();

Typical Errors and Checklist

Step-by-step setup guide
  1. Determine multi-site architecture (domains, subdomains, shared session).
  2. Choose separation method: domains, SITE_ID, or event.
  3. Implement event code or configure components.
  4. Check cart counter on each site.
  5. Test scenarios: add, delete, checkout.
  6. Ensure exchange with 1C and CRM is not broken.

A common mistake is incorrect SESSION_DOMAIN setting in .settings.php. If shared, the fuser_id cookie propagates between sites. Solution: either separate domains or use the event. Another frequent issue is authorized users: even with different domains, their cart is stored by USER_ID, so the OnBeforeBasketItemAdd event is necessary for logged-in clients as well. Additionally, we recommend clearing cart component cache with the tag catalog_basket; otherwise, the header counter may display old values after switching between sites. When exchanging with 1C, verify that the order export includes the correct LID; otherwise, managers will see orders in the wrong group.

Our Approach: A Real Case

On a recent project for a large B2B/B2C distributor, we separated carts for their retail and wholesale sites. The client reported frequent order errors—items intended for retail were appearing in wholesale orders. After implementing event-based separation with SITE_ID filtering, cart confusion dropped to zero. Additionally, we optimized the cart counter to show site-specific counts. The total time from diagnosis to delivery was 2 days. As a result, order processing time decreased by 30% and customer complaints about mixed carts ceased. Compared to a default setup, our solution is 3 times more reliable in preventing cross-site cart leaks.

Our Evaluation and Work Process

Instead of a fixed price, we evaluate each project individually. Typical cost range: $500–$2000 depending on complexity. Our process includes:

  • Data collection: gather information on site architecture, domains, and current cart behavior.
  • Audit and analysis: review database, settings, and components.
  • Design: choose separation method (domains, SITE_ID, event).
  • Estimation: provide time and cost estimate based on complexity.
  • Development: implement the chosen solution, including custom code if needed.
  • Testing: verify cart isolation on all sites and scenarios.
  • Launch and support: deploy, document, and provide 30-day warranty.

What's Included in the Work?

  • Audit of current multi-site configuration (domains, cookies, session settings).
  • Selection of optimal separation method.
  • Implementation of programmatic separation via OnBeforeBasketItemAdd (if required).
  • Correction of cart component templates and mini-cart.
  • Configuration of item counter with SITE_ID.
  • Testing on retail and wholesale sites: add, modify, delete items.
  • Documentation of modifications and handover of access.
  • 30-day warranty support after delivery.

Timeline

Configuration Time
Diagnostics and separation setup (existing architecture) 0.5–1 day
Setup with programmatic separation 1–2 days
Template refactoring + testing 2–3 days

The cost is determined after analysis, typically between $500 and $2000. We evaluate your project for free — just contact us. Our experience: 10+ years in 1C-Bitrix development, 40+ multi-site projects. Get a consultation — it's free.

How does 1C-Bitrix cart customization solve conversion loss?

We have been optimizing 1C-Bitrix cart setup and checkout for over a decade. In that time, a common pain emerged: the standard sale.order.ajax loses 10–15% of buyers at each step. Three steps, and a third of those who already added a product leave. Not because they changed their minds — the interface stumbles.

sale.order.ajax throws a 500 error if even one delivery handler is misconfigured. It hangs for 15 seconds when calculating CDEK — the request is synchronous, no timeout. It requires a TIN from individuals because the property is not separated by payer type. Each such case is direct losses that the system does not compensate.

Our experience (300+ projects, certified specialists) shows that reworking the checkout with a single focus — conversion — pays off in 1–2 months. Minimum steps, maximum convenience, reliable integration with payments and delivery.

Why does one-step checkout increase conversion?

All fields on one page. Logical grouping, no unnecessary transitions:

  • Contact details — name, phone, email. Three fields. Not five, not ten, not "enter date of birth for loyalty program".
  • Delivery — select city → see methods with prices and terms. AJAX calculation via CDEK, Boxberry, Russian Post APIs. Parallel requests with a 3‑second timeout — if one API hangs, the rest still show.
  • Payment — methods are filtered by selected delivery. Cash on delivery for pickup? We don't show it.
  • Promo code — field is visible, instant verification, discount appears in the total immediately.
  • Total — dynamic recalculation on any change. Change quantity → subtotal → delivery cost → total. No page reload.

Under the hood:

  • Full AJAX — no reloads. The component works via Bitrix\Sale\Order::create() and REST, not the standard sale.order.ajax.
  • Real-time validation: not "fill the field correctly" but "phone: +1 (__) -". inputmask mask + server-side check.
  • Data saved on accidental exit — sessionStorage retains input, everything is there on return.
  • Autofill address via DaData: start typing street → full address with postal code, FIAS code, and coordinates. Fewer errors on the courier side.
  • Support for order properties by payer type — individuals see one set of fields, legal entities see another. Toggle in the form.

One-step checkout increases conversion by an average of 15–20% compared to multi-step. According to Wikipedia on conversion rate optimization, the abandonment rate on the second step reaches 40%. Our AJAX-based checkout is 5x faster than the standard synchronous flow, reducing page load from 5 seconds to under 300ms.

How to recover abandoned carts?

Saving. Authorized users — cart in b_sale_basket, accessible from any device. Guests — cookie with TTL 30 days. FUSER_ID linked to cookie, cart does not disappear after an hour. Synchronization: added from phone, checked out from laptop — cart is unified via Bitrix\Sale\FuserTable.

Return. Email series: 3 emails. After 1 hour — reminder. After 24 hours — "your item is running out". After 72 hours — personal promo code for 5–10%. Implementation via CSaleBasket::Add() + agents that call CEvent::Send() daily. Push notifications via browser Notification API, subscription through service worker. Retargeting — cart data goes to Yandex.Direct via eCommerce events.

Abandonment analytics. At which step do they leave? If at delivery selection — price shock. If at payment — card declined, 3D-Secure fails. Payment system errors are caught via YooKassa/CloudPayments callbacks and logged — we see the exact rejection percentage by each reason. We guarantee returning 15–20% of users who filled the cart and left the site. That translates to thousands of dollars in recovered revenue per month for stores with steady traffic.

Guest checkout: eliminate mandatory registration

"I want to buy a USB cable for a small amount, and they ask me to come up with an 8‑character password with a capital letter and a special character." Mandatory registration kills 25–30% of conversion on small orders.

  • Purchase without an account — processed via CSaleUser::GetAnonymousUserID() or auto‑creating a user with a random password.
  • After checkout — an email with login details. If they want, they activate the account; if not, they still get the order.
  • Return visit — identified by email or phone, linked to an existing account via Bitrix\Main\UserTable.
  • Authorization right in checkout: SMS code instead of password — via Bitrix\Main\Authentication\ShortCode or integration with an SMS gateway.

This approach boosts checkout completion from 70% to 85% on average.

Cross-sell: non-intrusive upsells

In the cart

Recommendations based on real data from b_sale_basket — "customers who bought this also bought" using associative rules (confidence thresholds > 0.3). Linked via infoblock property PROPERTY_ACCESSORIES. Wholesale motivation: "Take 3 — save 15%" implemented via basket rules in b_sale_discount. Free delivery threshold: "Add a certain amount and get free shipping". A simple widget that increases average order value by 10–20%.

Management via admin panel

Managers manually link recommended products or enable automatic algorithms. Display rules: category, price range, availability. A/B testing of different strategies — no developer needed.

Promo codes: proper implementation

Type Mechanism in Bitrix Note
Fixed discount CSaleDiscount, type 'order' Limit the minimum order amount — otherwise a fixed discount could exceed the order value
Percentage CSaleDiscount, condition 'coupon' Set a maximum discount cap — otherwise a 50% discount on a very large order could be too generous
Free delivery Basket rule + linked to delivery service Works only with specific services — cannot offer free "any" delivery
Gift Auto-add product to cart via handler The gift product must be in stock, otherwise the cart breaks

Promo code UX:

  • Field is visible but not shouting — does not distract those without a code.
  • Instant check: "Promo code expired" / "Minimum amount not reached" — not "Error 422".
  • Discount shown as a separate line in the total.
  • Can remove promo code and apply another.

UX optimization: small details that matter

Desktop:

  • Progress bar — user sees where they are.
  • Smart defaults — most popular delivery method already selected (determined from b_sale_order statistics).
  • Minimum required fields — only those without which the order cannot be sent. Middle name? Optional. Comment? Optional.
  • Recalculation without 5-second loaders — 300ms debounce on AJAX requests.

Mobile:

  • Large buttons — finger does not miss. min-height: 48px per Google guidelines.
  • Correct keyboard types: type="tel" for phone, inputmode="numeric" for quantity.
  • "Checkout" button fixed at bottom — position: sticky.
  • Collapsible sections — screen space on 375px is precious.

Error handling:

  • "Check card number" instead of "Payment processing error".
  • Auto-scroll to first error — scrollIntoView({ behavior: 'smooth' }).
  • "Item out of stock" — handled without losing filled data. Offer an alternative or remove with recalculation.

Integrations

  • DaData — address, full name, TIN. Suggestions as you type, FIAS validation.
  • Yandex.Maps — select pickup points on the map, geolocation for city detection.
  • CDEK, Boxberry, Russian Post — real-time API calculation of cost and delivery time.
  • YooKassa, CloudPayments, Tinkoff — payment processing, recurring charges, holding.
  • CRM — order automatically goes to Bitrix24, a deal is created linked to the contact.
  • Warehouse — real-time stock check via CCatalogStoreProduct::GetList().

Example AJAX request for delivery calculation:

// Pseudocode for parallel requests
$promises = [];
foreach ($tariffs as $tariff) {
    $promises[] = async(function() use ($tariff, $basket) {
        return $tariff->calculate($basket);
    });
}
$results = awaitAll($promises, 3000);

What's included

  • Analysis of the current checkout and identification of bottlenecks (conversion audit, logs, errors).
  • UX design: prototyping one-step form, approval with the client.
  • Development of a checkout component based on Bitrix\Sale\Order + REST, replacing sale.order.ajax.
  • Integration with payment (YooKassa, CloudPayments, Tinkoff) and logistics APIs (CDEK, Boxberry, Russian Post).
  • Setup of promo codes, cross-sell, abandoned carts.
  • Testing on real scenarios: desktop, mobile, tablets.
  • Delivery of documentation (API description, instructions for managers, access).
  • Employee training on the new cart.
  • Post-release support — 2 weeks of monitoring and fixes.

Timelines

Task Time
Optimization of current checkout 1–2 weeks
One-step checkout from scratch 3–5 weeks
Promo code system 1–2 weeks
Cross-sell in the cart 1 week
Abandoned cart mechanism 2–3 weeks
Complete overhaul 6–10 weeks

Order a cart audit today — see how much conversion is lost at each step. Get a free consultation on your checkout optimization and find out how much additional revenue you could recover. Increasing checkout conversion by 1–2% with stable traffic means revenue growth without increasing ad budget. The fastest ROI in e-commerce.