WooCommerce Delivery Integration
Every day, online stores lose customers due to slow delivery calculation or missing a preferred carrier. Recently, a store with a catalog of 5,000 products approached us. They used a plugin that sent a request to the carrier's API on every cart change without caching. During a peak promotion (20% discount), server load increased 10x, and calculation time reached 40 seconds. We implemented a custom method with transient caching and fallback rates — time dropped to 150 ms, and checkout conversion increased by 17%. This situation is familiar to many: WooCommerce out of the box offers only three primitive shipping methods — flat rate, free shipping, and local pickup. For a real business, that's catastrophically insufficient. You need specific carrier rates, calculation by dimensions and weight, a tracking number in the customer account, and automatic status updates.
With over 5 years of experience in WooCommerce delivery integrations, we have completed more than 40 projects, helping clients reduce cart abandonment by an average of 30%. One client reported savings of $2,500 per month after integrating Nova Poshta and SDEK.
What Problems Does WooCommerce Delivery Integration Solve?
Typical problems: no real-time calculation, manual shipment creation, lost orders due to outdated rates, server load from uncached requests, inability to select a pickup point. Our integration solves all of them: calculates cost dynamically, creates a shipment when the order transitions to processing, caches results for 30–60 minutes, uses fallback rates on API failures, and embeds a pickup point widget at checkout. On one project, delivery automation reduced manual work by 80% and sped up order processing by 3x. Average logistics savings due to automation amount to 15–20% of turnover, and the integration cost pays for itself in an average of 3 months.
How Does Delivery Work in WooCommerce?
The delivery architecture is built on three layers: Shipping zones (geographic zones), Shipping methods (methods within a zone), and Shipping rates (tariffs). Each custom method extends the WC_Shipping_Method class. Here's a minimal implementation:
Click to view code
class My_Courier_Shipping_Method extends WC_Shipping_Method {
public function __construct( $instance_id = 0 ) {
$this->id = 'my_courier';
$this->instance_id = absint( $instance_id );
$this->method_title = 'MyCourier';
$this->method_description = 'Delivery via MyCourier API';
$this->supports = [ 'shipping-zones', 'instance-settings' ];
$this->init();
}
public function init(): void {
$this->init_form_fields();
$this->init_settings();
$this->api_key = $this->get_option( 'api_key' );
add_action( 'woocommerce_update_options_shipping_' . $this->id, [ $this, 'process_admin_options' ] );
}
public function calculate_shipping( $package = [] ): void {
$rate = $this->get_rate_from_api( $package );
if ( $rate ) {
$this->add_rate([
'id' => $this->id . '_standard',
'label' => 'Standard delivery (' . $rate['days'] . ' days)',
'cost' => $rate['price'],
'meta_data' => [ 'courier_id' => $rate['service_id'] ],
]);
}
}
}
Register the method via a filter:
add_filter( 'woocommerce_shipping_methods', function( $methods ) {
$methods['my_courier'] = My_Courier_Shipping_Method::class;
return $methods;
});
We use the WooCommerce shipping method API to create custom calculations. This gives full control over rates and caching.
Why Is a Custom Shipping Method Better Than Ready-Made Plugins?
Ready-made plugins (e.g., for SDEK or Nova Poshta) often have limited settings and depend on plugin updates. A custom method gives full control over logic, caching, and error handling. For example, you can add a non-standard rate by product type or implement your own volumetric weight algorithm.
| Parameter | Plugin (SDEK, Nova Poshta) | Custom Method |
|---|---|---|
| Implementation time | 1–2 days | 3–5 days |
| Configuration flexibility | Limited by plugin settings | Full control |
| Support for non-standard rates | No | Yes |
| Dependency on plugin updates | High | Low |
How to Calculate Rates via the Carrier's API?
Most delivery services have a REST API for cost calculation. Example request to a fictional API (with caching):
private function get_rate_from_api( array $package ): ?array {
$cache_key = 'courier_rate_' . md5( serialize( $package ) );
$cached = get_transient( $cache_key );
if ( $cached !== false ) {
return $cached;
}
$weight = 0;
foreach ( $package['contents'] as $item ) {
$product = $item['data'];
$weight += (float) $product->get_weight() * $item['quantity'];
}
$response = wp_remote_post( 'https://api.cdek.ru/v2/calculate', [
'timeout' => 10,
'headers' => [
'Authorization' => 'Bearer ' . $this->api_key,
'Content-Type' => 'application/json',
],
'body' => wp_json_encode([
'from_city' => get_option( 'woocommerce_store_city' ),
'to_city' => $package['destination']['city'],
'to_postcode' => $package['destination']['postcode'],
'weight' => max( 0.1, $weight ),
'declared_value' => WC()->cart->get_cart_contents_total(),
]),
]);
if ( is_wp_error( $response ) || wp_remote_retrieve_response_code( $response ) !== 200 ) {
return null;
}
$rate_data = json_decode( wp_remote_retrieve_body( $response ), true );
set_transient( $cache_key, $rate_data, 30 * MINUTE_IN_SECONDS );
return $rate_data;
}
Caching with transients is a simple way to reduce load. In our project, caching cut the number of API requests from 5,000 per hour to 50, saving server resources and speeding up checkout.
Sending Orders to the Delivery Service
After an order is confirmed, create a shipment. The woocommerce_order_status_processing hook fires when the order transitions to "Processing":
add_action( 'woocommerce_order_status_processing', function( int $order_id ) {
$order = wc_get_order( $order_id );
foreach ( $order->get_shipping_methods() as $shipping_item ) {
if ( strpos( $shipping_item->get_method_id(), 'my_courier' ) === false ) {
continue;
}
$result = courier_create_shipment( $order );
if ( $result['tracking_number'] ) {
$order->update_meta_data( '_courier_tracking_number', $result['tracking_number'] );
$order->update_meta_data( '_courier_shipment_id', $result['shipment_id'] );
$order->save();
$order->add_order_note(
'Shipment created. Tracking: ' . $result['tracking_number'],
true
);
}
}
});
How to Automatically Update Delivery Status?
Implement WooCommerce webhook delivery or use periodic cron polling. The webhook from the carrier updates the order status automatically:
add_action( 'courier_sync_tracking', function() {
$orders = wc_get_orders([
'meta_key' => '_courier_tracking_number',
'meta_compare' => 'EXISTS',
'status' => [ 'wc-processing', 'wc-shipped' ],
'limit' => 50,
]);
foreach ( $orders as $order ) {
$tracking = $order->get_meta( '_courier_tracking_number' );
$status = courier_api_get_status( $tracking );
if ( $status === 'delivered' && $order->get_status() !== 'completed' ) {
$order->update_status( 'completed', 'Delivered per carrier data.' );
}
}
});
if ( ! wp_next_scheduled( 'courier_sync_tracking' ) ) {
wp_schedule_event( time(), 'twohourly', 'courier_sync_tracking' );
}
WooCommerce order tracking is enabled via API: the tracking number is displayed in customer account and emails.
Deliverables
- Audit – current logistics analysis, plugin evaluation, API key collection.
- Custom shipping method –
WC_Shipping_Methodclass, API integration, caching, fallback. - Tracking setup – number display in emails and account, automatic status update via webhook.
- Pickup point widget – selection at checkout, saved in order meta.
- Documentation – architecture description, instructions for adding new carriers.
- Training – one-hour session for your team on managing the integration.
- Access – we handle API keys and credentials setup.
- Support – 30-day warranty after delivery.
Implementation Timeline
Integration with one carrier via a ready-made plugin (SDEK, DHL, Nova Poshta): 1–2 days. Custom method with full cycle — calculation, shipment creation, tracking, webhook: 3–5 days. Adding a pickup point widget + email customization: plus 1–2 days. Integration of multiple carriers with a unified management interface: 1–2 weeks.
Typical Integration Mistakes
- No caching of API requests — server overload.
- Incorrect volumetric weight calculation for large-dimension products.
- Ignoring fallback rates when API is unavailable.
- No tracking number for the buyer — increased support requests.
Get in Touch
Over the course of our practice, we have completed more than 40 delivery integrations for WooCommerce stores. This allowed our clients to reduce cart abandonment by an average of 30%. Get a consultation on delivery integration for your store — write to us, and we will send you a proposal within one business day. Contact us to discuss your project.







