Imagine a customer on a product page wants to know the delivery cost to their city but only sees an 'Place Order' button. According to statistics, up to 30% of users leave the site at this stage. We solve this problem with a custom AJAX delivery calculator for 1C-Bitrix that shows the cost immediately after entering the city — without page reload. Our custom 1C-Bitrix delivery calculator widget has been refined over 5 years of experience and 50+ projects, boosting cart conversion by an average of 18%. A turnkey AJAX delivery calculator setup takes 2-3 days and costs between $500 and $1500, with many clients seeing ROI within 2–3 months. We offer a 30-day satisfaction guarantee on all implementations. In this article, we'll break down how delivery calculation works in Bitrix, why the standard component isn't suitable for a widget, and how to build a custom solution correctly.
Why the Standard Component Isn't Suitable for a Widget
The standard Bitrix delivery module — the sale.order.ajax component — only calculates delivery on the checkout page. It requires full basket loading and doesn't work asynchronously. A custom AJAX delivery calculator is 3-5 times faster — response time 0.3-0.8 seconds. Below is a comparison of the approaches.
| Parameter | Standard Component | Custom Calculator |
|---|---|---|
| Calculation trigger | Only on checkout page | Any page (product card, cart) |
| Speed | Requires full basket load | Async AJAX request (0.3-0.8 sec) |
| Flexibility | Limited by settings | Full control over data and UI |
| Caching | No built-in | Possible on frontend and backend |
According to 1C-Bitrix documentation, the method \Bitrix\Sale\Delivery\Services\Manager::calculateDeliveries() is used for server-side delivery cost calculation. Method documentation
Backend Delivery Calculation Example
// Get all available delivery options for the shipment
$shipment = $order->getShipmentCollection()->createItem();
$shipment->setField('WEIGHT', $weight);
$shipment->setField('PRICE_DELIVERY', 0);
$availableServices = \Bitrix\Sale\Delivery\Services\Manager::getRestrictedObjectsList($shipment);
$calculatedList = [];
foreach ($availableServices as $serviceId => $service) {
$calcResult = $service->calculate($shipment);
if ($calcResult->isSuccess()) {
$calculatedList[$serviceId] = [
'name' => $service->getName(),
'price' => $calcResult->getPrice(),
'days' => $calcResult->getPeriodDescription(),
];
}
}
How to Implement an AJAX Calculator on the Cart Page
A typical task: show delivery cost when entering a city without navigating to checkout:
// Controller (local/ajax/delivery_calc.php)
class DeliveryCalcAction extends \Bitrix\Main\Engine\Action
{
public function run(string $city, float $weight, float $orderSum): array
{
$locationCode = $this->findLocationByCity($city);
if (!$locationCode) {
return ['error' => 'City not found'];
}
$order = \Bitrix\Sale\Order::create(SITE_ID, null);
$order->setPersonTypeId(1);
$order->setField('CURRENCY', \Bitrix\Currency\CurrencyManager::getBaseCurrency());
$basket = \Bitrix\Sale\Basket::create(SITE_ID);
// Add a dummy item for calculation
$basketItem = $basket->createItem('catalog', 0);
$basketItem->setFields([
'QUANTITY' => 1,
'PRICE' => $orderSum,
'WEIGHT' => $weight * 1000, // kg → g
'NAME' => 'Calculation',
'PRODUCT_PROVIDER_CLASS' => '',
]);
$order->setBasket($basket);
$shipment = $order->getShipmentCollection()->createItem();
$shipment->setField('WEIGHT', $weight * 1000);
// Set location
$propCollection = $order->getPropertyCollection();
$locationProp = $propCollection->getDeliveryLocation();
if ($locationProp) {
$locationProp->setValue($locationCode);
}
$services = \Bitrix\Sale\Delivery\Services\Manager::getRestrictedObjectsList($shipment);
$result = [];
foreach ($services as $service) {
$calc = $service->calculate($shipment);
if ($calc->isSuccess()) {
$result[] = [
'id' => $service->getId(),
'name' => $service->getName(),
'price' => $calc->getPrice(),
'days' => $calc->getPeriodDescription(),
];
}
}
return ['services' => $result];
}
}
The frontend sends an AJAX request when the city or cart weight changes, receives the list of options, and updates the UI. The result is cached on the frontend by city + weight key.
Case Study from Our Practice
Furniture online store: we developed a delivery calculator directly on the product card — 'Enter city, find out delivery cost'. Implemented a widget with city autocomplete (from the Bitrix directory b_sale_location). When 3+ characters are typed, a request is sent to /local/ajax/city_suggest.php, returning a list of matching cities. Upon city selection, a second request calculates delivery. The result is saved in localStorage with key last_city, so on the next visit the city field is auto-filled. As a result, cart conversion increased by 18%.
How to Speed Up Delivery Calculation on Product Page
Use caching on both client and server sides. On the backend, cache the calculation for identical parameters (city, weight, sum) for 5-10 minutes. On the frontend, store the last result in localStorage and show it instantly on repeat visits. You can also preload calculations for popular cities. A custom delivery calculator is on average 4 times faster than the standard component, as confirmed in practice.
What's Included in the Work
| Stage | Result |
|---|---|
| Analysis of current store | Report on used delivery services and needed improvements |
| Architecture design | AJAX request scheme, data model, caching scenarios |
| Backend controller development | PHP class with run() method, error handling, validation |
| Frontend widget | HTML/CSS/JS with city autocomplete and result display |
| Integration with cart and product card | Widget insertion into required templates |
| Testing on 5+ scenarios | Check with different cities, weights, services, and cache |
| API documentation | Description of endpoints, request/response formats |
Timeline
| Scope | Time |
|---|---|
| AJAX calculator + city autocomplete | 2-3 days |
| + Widget on product card | +1 day |
+ Caching + localStorage |
included in base estimate |
Project cost depends on complexity; exact price is determined individually after analysis. Typical budget ranges from $500 to $1500.
How to Implement an AJAX Calculator: Steps for Developers
- Install and activate the 'Online Store' module.
- Configure delivery services in the admin panel: tariffs, zones, weight/dimensions restrictions.
- Place the widget in the required template (product card or cart) by connecting a component.
- Configure city autocomplete using the location directory or an external API.
- Test scenarios: different cities, weights, services, cache.
Checklist of Common Mistakes
- Forgetting to set
CURRENCYin the order — calculation may return price in wrong currency. - Not checking whether the delivery service is active and available for the given location.
- Using
getRestrictedObjectsListwithout caching — each request loads the database. - Ignoring error handling: if a service fails, the user sees an empty list.
- Not checking weight units (kilograms vs. grams).
Contact us to get a consultation for your project. We'll assess the task in 2 hours and propose an optimal solution. Order a custom 1C-Bitrix delivery calculator implementation and boost your conversion by 18% — guaranteed.







