Setting up delivery routing in 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.
Our competencies:
Development stages
Latest works
  • image_website-b2b-advance_0.png
    B2B ADVANCE company website development
    1175
  • 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
    747
  • 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 Delivery Routing on 1С-Bitrix

Delivery routing is automatic selection of delivery method, shipping warehouse, and delivery zone depending on buyer's address. In Bitrix basic routing configured via delivery zones and rules, but for complex scenarios with multiple warehouses and different carriers, additional logic needed.

Delivery zones in Bitrix

Delivery zones stored in b_sale_location — hierarchical regional reference. Delivery methods (b_sale_delivery_service) bound to zones via b_sale_delivery_location. When buyer selects city, Bitrix shows only delivery methods working in that zone.

Add delivery method binding to zone:

\Bitrix\Sale\Delivery\Services\Manager::save([
    'ID'     => $deliveryServiceId,
    'ACTIVE' => 'Y',
    'RESTRICTED_LOCATION' => [$locationId1, $locationId2],
]);

Selecting shipping warehouse by address

Logic "which warehouse is closer to delivery address" absent in standard Bitrix. Realized via OnSaleShipmentBeforeSave event handler or custom checkout handler.

Simple implementation — table bl_store_zones with mapping location_id → store_id. On shipment creation, determine region from delivery address and assign warehouse:

$locationId = $order->getPropertyCollection()
    ->getItemByOrderPropertyCode('LOCATION')
    ?->getValue();

$storeId = StoreZoneTable::getStoreByLocation($locationId) ?? DEFAULT_STORE_ID;

$shipment->setField('DELIVERY_DOC_NUM', $storeId);

Prioritizing carriers

With multiple active delivery services, automatically offer optimal by cost or speed. Create prioritization rules in bl_delivery_rules:

Field Description
location_group Region or region group
order_weight_from / to Weight range
delivery_service_id Priority delivery service
priority Offer order

Agent or cart component when calculating delivery sorts available services by these rules.

Configuring rules via administrative section

To manage routing rules without code editing, create administrative component. Use CAdminList or React component in /local/admin/. Data stored in b_option (for simple settings) or custom table (for complex).

What we configure

  • Delivery zones in b_sale_location and binding delivery services to zones
  • Table bl_store_zones with mapping regions to shipping warehouses
  • Logic for warehouse selection on shipment creation
  • Carrier prioritization rules by weight and region
  • Administrative interface for managing routing rules