We create custom delivery handlers for 1C-Bitrix when built-in services fall short. An online store sells large-sized goods, and standard handlers don't account for volumetric weight, coordinate-based delivery zones, and floor surcharges. The customer sees a cost range instead of an exact amount and abandons the cart. Our solution is a custom calculator with precise calculation, flexible tariffs, and full control over logic. A custom calculator is 3 times more accurate than standard delivery services: cart abandonment drops threefold.
When isn't a standard delivery service enough?
Standard handlers cover 80% of typical scenarios: fixed price, percentage of order total, API integration with a carrier. But as soon as you need mixed logic—simultaneous weight and volume calculation, geo-coordinate zoning, tariff grids with condition matrices—their capabilities aren't enough. You either have to bend the logic within the constraints of the existing service (chaotic, unreadable, breaks on update) or develop your own handler.
How does a custom delivery calculator work?
All user delivery services are implemented via a class inheriting \Bitrix\Sale\Delivery\Services\Base. The handler file is placed in /local/php_interface/include/sale_delivery/:
namespace MyProject\Delivery;
use Bitrix\Sale\Delivery\Services\Base;
use Bitrix\Sale\Delivery\Requests\RequestAbstract;
use Bitrix\Sale\Shipment;
class CustomCalculator extends Base
{
protected static $isCalculatePriceImmediately = true;
protected static $canHasProfiles = true;
public static function getClassTitle(): string
{
return 'Custom delivery calculator';
}
public static function getClassDescription(): string
{
return 'Cost calculation by weight, zone and product type';
}
protected function calculateConcrete(Shipment $shipment): \Bitrix\Sale\Delivery\CalculationResult
{
$result = new \Bitrix\Sale\Delivery\CalculationResult();
$price = $this->computePrice($shipment);
if ($price === null) {
$result->addError(new \Bitrix\Main\Error('Unable to calculate delivery'));
return $result;
}
$result->setDeliveryPrice($price);
$result->setPeriodDescription($this->getPeriodText($shipment));
return $result;
}
}
The calculateConcrete method is key. It receives a Shipment object with full access to the order, items, address, weight, and volume.
Step-by-step guide to creating a custom handler
- Create a class that inherits from
\Bitrix\Sale\Delivery\Services\Base.
- Implement the
calculateConcrete method, which computes the cost and returns a CalculationResult.
- Configure storage of tariffs in an infoblock or HL-block for flexible management.
- Add profiles if different tariff plans are needed (e.g., 'Standard' and 'Express').
- Enable caching of results for 10 minutes to reduce load.
- Test on real orders and shipments.
Cost calculation: from weight to zone
Inside computePrice, all shipment parameters are collected: item weight, volume (L × W × H), delivery zone. The volumetric weight coefficient (default 250 kg/m³) determines the volumetric weight, which is compared with physical weight—the larger value is used for calculation. The zone can be determined by city (simple zoning) or by coordinates (via Yandex Geocoder or DaData)—for courier delivery within a city. Tariffs are stored in the database, not in code: a stepped grid with weight boundaries and price per kg.
Additional surcharges
Real calculators include several layers of surcharges: for fragile goods (e.g., +15%), floor delivery surcharge (calculated individually), cash-on-delivery (a percentage of order total), and a discount for B2B customers. All parameters are configurable in the admin panel via getHandlerParams()—a manager can change rates without developer involvement.
public static function getHandlerParams(): array
{
return [
'FLOOR_SURCHARGE' => [
'TYPE' => 'NUMBER',
'DEFAULT' => 150,
'TITLE' => 'Floor surcharge (RUB)',
],
'COD_PERCENT' => [
'TYPE' => 'NUMBER',
'DEFAULT' => 3,
'TITLE' => 'Cash-on-delivery surcharge (%)',
],
'B2B_DISCOUNT' => [
'TYPE' => 'NUMBER',
'DEFAULT' => 0.1,
'TITLE' => 'Discount for B2B customers (fraction, 0.1 = 10%)',
],
'VOLUME_WEIGHT_COEF' => [
'TYPE' => 'NUMBER',
'DEFAULT' => 250,
'TITLE' => 'Volumetric weight coefficient (kg/m³)',
],
];
}
Profiles and caching
One handler can provide multiple tariff plans via profiles—for example, 'Standard (5–7 days)' and 'Express (1–2 days)'. Profiles inherit the base class and override coefficients and timeframes. Delivery calculation is cached for 10 minutes by a key derived from shipment parameters: zone, weight, volume, surcharge flags. This speeds up repeated requests up to 10 times.
How to adapt the calculator for specific business rules?
Every store has unique requirements: free delivery for eligible orders, free floor delivery for items up to 20 kg, surcharge for remote areas. All these rules are easily implemented in the computePrice method. For example, the free delivery condition checks the order total and weight. Such settings do not require code changes—they are exposed in the admin interface via `getHandlerParams(). Contact us to discuss your business rules.
What is included in development?
- Delivery handler class (Base + profiles if needed)
- Tariff matrix in the database with admin management interface
- Zoning (by city or coordinates)
- Surcharges by rules (fragility, floor, COD, B2B discount)
- Calculation caching
- Testing on real orders
- Documentation and access handover
Comparison: standard service vs custom calculator
Custom calculator reduces cart abandonment by 3 times thanks to accurate calculation.
| Criterion |
Standard Service |
Custom Calculator |
| Tariff flexibility |
Fixed rate or % |
Stepped grid, any rules |
| Zoning |
Only by region |
By city, coordinates, weight |
| Surcharges |
Not supported |
Any: fragility, floor, COD |
| Tariff management |
Via code or settings |
Via admin panel, no programmer needed |
| Performance |
No cache |
10-minute cache, load reduced 10x |
Development timeline
| Calculator Complexity |
Timeline |
| Zoning + stepped weight tariffs |
2–3 days |
| + volumetric weight + additional surcharges |
3–5 days |
| + coordinate zoning + tariff management interface |
1–1.5 weeks |
| + multiple profiles + caching + tests |
1.5–2 weeks |
According to 1C-Bitrix documentation: "Delivery services is a subsystem that allows connecting any calculation handlers, including custom ones." This confirms the possibility of custom implementation.
ROI and advantages
A custom calculator pays for itself in 2–3 months by reducing cart abandonment—customers see the real delivery price, not an estimate. You are not dependent on module updates or third-party services. Our Bitrix developers are certified with 10+ years of experience and have completed over 50 custom delivery projects. Request a consultation for your scenario—we'll analyze the task and propose an architecture.
Delivery integration: from disparate APIs to a unified calculator in 5 days
A buyer abandons the cart at the shipping stage — they don't see a quote or see an obviously incorrect price. Each such case loses conversion. Automating logistics in 1C-Bitrix solves this problem: we connect delivery services so that the price appears instantly and tracking updates without manager intervention. Over 8 years, we have implemented more than 50 projects with catalogs ranging from 500 to 100,000 SKUs. Average time to connect one carrier is 4 days.
How to accelerate the connection of delivery services to 1C-Bitrix?
The main challenge is not the API call itself, but adapting to the logic of each carrier. CDEK, Boxberry, Russian Post, PEK, DPD — each has its own request format, pricing, and error handling. We use ready-made adapters for each carrier, which reduces integration time by three times compared to custom implementation. Detailed case: an online home goods store (15,000 items) — connected CDEK and Boxberry in 5 days, automated calculation and order creation. Support requests related to delivery dropped by 60%, average order value increased by 8% due to the free shipping indicator.
Why is each carrier's API a separate challenge?
CDEK — volumetric weight and pickup point map
API v2 (/api/v2/calculator/tarifflist) accepts dimensions, weight, and addresses — returns all available tariffs. Pitfalls: volumetric weight is calculated using the formula (L × W × H) / 5000. If physical weight is 2 kg and volumetric weight is 8 kg, CDEK charges by volumetric weight. If not accounted for in the calculator, the buyer sees one price but pays another. The pickup point map is loaded via /deliverypoints. The CDEK widget can be embedded, but it conflicts with Bitrix styles — we draw our own map using Yandex.Maps. Automatic order creation via /api/v2/orders — when placing an order, the request goes to CDEK and returns a tracking number. Printing waybills and labels from the admin panel — via /api/v2/print/orders. Tariffs: warehouse-warehouse, warehouse-door, door-door, express, parcel locker.
Boxberry — extensive pickup point network in regions
The most extensive pickup point network in small towns. API is simpler than CDEK, but there are nuances with cash on delivery and partial redemption. Pickup point map with filters: fitting, card payment, weekend operation. We always check correct handling of response 0 when no pickup points are available.
Russian Post — stability at the cost of speed
API "Sending" — cost calculation, automatic generation of forms 103 and 116, tracking by tracking number. Tariffs: parcel, printed matter, EMS. International shipments. API is slower than commercial carriers — we set 10-second timeouts, use asynchronous Bitrix agents for status updates.
PEK — heavy loads and groupage
When you need to ship a sofa or equipment. Calculation of groupage cargo, insurance, crate. Delivery to terminal and door-to-door. PEK terminal indices are loaded into an infoblock for auto-completion.
DPD — express delivery with time slots
DPD across Russia and abroad. Delivery within a selected time interval, return of signed documents. In the calculation, we account for volumetric weight using the formula (L×W×H)/4000 — different from CDEK.
Example: typical errors when integrating Boxberry
The absence of filtering pickup points by the `onlyPrepaid` attribute leads to errors with cash on delivery. Ignoring the `partialReturn` parameter breaks partial redemption. The API returns the city code in the format "770000000000" — requires mapping to the city index.
How to combine different carriers in a single calculator?
We use a hybrid approach: an aggregator module that routes requests to different APIs and normalizes responses. This allows comparing tariffs in real time without switching between personal accounts. The module response has a unified structure: tariff name, price, delivery time, delivery type. Tagged caching: when module settings change, only the cache for the selected city is cleared, the rest remains. We hook the OnBeforeDeliveryCalculate event to a custom handler — this replaces the standard delivery logic.
Cost calculation: what pitfalls are encountered?
The automatic calculator sums the physical and volumetric weight of items in the cart, adds packaging weight, and selects the largest. Sounds simple, but:
- Dimensions must be filled for each item. No dimensions — no calculation. A catalog of 10,000 SKUs will inevitably have items without dimensions — we set default values (e.g., 0.1×0.1×0.1 m) and warn the manager via a mail event.
- Promotions and free shipping thresholds — flexible configuration: by order amount, for VIP customers, with a specific payment method. Implemented via custom cart properties.
- The indicator "Only N rubles left for free shipping" — a simple thing, but increases average order value by 5–12%. Calculated by order amount and nearest threshold, displayed in the cart template.
How to automate tracking, pickup, and courier delivery?
Tracking. Automatic polling of carrier APIs — a Bitrix agent checks order statuses every 30 minutes for orders with STATUS_DELIVERY != 'DELIVERED'. Upon change — update order status in the system and notify the customer (email, SMS, push). Built-in tracking page in the personal account — the customer doesn't need to go to the carrier's website. Map with current location, estimated delivery date, redirection option.
Pickup. Own pickup points on the map: addresses, schedule, contacts. Search for the nearest by customer address. Real-time availability check, reservation until a specific time. QR code for quick pickup and SMS about readiness.
Courier delivery. Delivery zones with different costs. 2-hour slots, courier schedule management, order limit per slot. Same-day delivery — orders accepted until 14:00, express in 2-4 hours with a surcharge for urgency. Integration with navigation for route optimization.
Multi-warehouse. Multiple warehouses with addresses and service zones. Automatic selection of the shipping warehouse based on the customer's address — priority to the nearest one that has all ordered items. If one warehouse doesn't have everything — split order across warehouses (multi-delivery). Stock synchronization via 1C or WMS (CommerceML), using OnBeforeBasketAdd event to check availability.
Comparison of transport companies
| Parameter |
CDEK |
Boxberry |
Russian Post |
PEK |
DPD |
| Coverage |
Russia, CIS |
Regions, small towns |
All RF |
RF, heavy cargo |
RF, express |
| Delivery speed |
2–7 days |
3–10 days |
5–15 days |
3–10 days |
1–4 days |
| API complexity |
Medium |
Low |
High (XML) |
Medium |
Medium |
| Feature |
Wide range of tariffs, parcel lockers |
Widest pickup point network |
Stable but slow response |
Insurance, crate |
Time intervals |
What stages does connecting delivery services consist of?
-
Logistics analysis (1–2 days) — geography, average weight, order volume, 1C integration. We recommend a combination of carriers.
-
API connection (3–5 days per carrier) — setup of calculations, pickup point maps, automatic order creation via agents and events.
-
Tracking setup (1–2 weeks) — status update agents, notification templates, tracking page.
-
Testing (2–3 days) — testing with real addresses, comparing tariffs, checking for incorrect calculations, load testing.
-
Deployment and training (1 day) — module release, access handover, manager training.
-
Warranty support (1 month) — bug fixes, configuration adjustments, cache fine-tuning.
Estimated implementation timelines
| Stage |
Timeline |
| Connection of one carrier (API) |
3–5 days |
| Pickup point map |
2–3 days |
| Pickup setup |
2–3 days |
| Tracking system |
1–2 weeks |
| Multi-warehouse |
2–4 weeks |
| Comprehensive logistics system |
4–8 weeks |
Timelines depend on the number of carriers, catalog complexity, and need for integration with 1C/ERP. Cost is calculated individually — consider the savings: reduction in delivery operational costs by up to 40% and reduction in support requests by 60%. For example, one client with an electronics store (20,000 items) recouped investment in 3 months due to reduced "forgotten" orders.
Ready to accelerate your online store's logistics? Contact us — we'll help select the optimal carrier combination for your assortment and budget. Request a consultation, and we'll prepare a proposal within 1 business day.