If you’re using Cash on Delivery (COD) alongside a deposit/advance payment system on your WooCommerce store, chances are you’re using the popular Deposits & Partial Payments for WooCommerce plugin.
This setup allows your customers to:
-
Pay a small advance upfront (say ₹100)
-
And pay the remaining balance (say ₹900) when the order is delivered
Sounds perfect—except there’s a catch.
The Problem with Logistics Integrations like Shiprocket
When your order is pushed to Shiprocket or any other shipping provider, they receive the full order value (₹1,000). That means:
Shiprocket expects the delivery person to collect ₹1,000
Even though the customer has already paid ₹100 online
This creates confusion for customers, delivery agents, and you as the seller.
The Solution: Modify the Order Data Before It’s Sent
Our Shipment Tracker for WooCommerce plugin offers a powerful filter:
bt_shiprocket_order_object
You can use this to modify the data being sent to Shiprocket—including the COD amount, payment mode, and total—based on custom logic.
Here’s how you can automatically send only the pending COD amount to Shiprocket for partial payment orders:
Code Sample: Adjust Order Data for Shiprocket
What This Code Does
-
Detects if the order used the Deposits plugin
-
If so, it fetches the pending COD amount
-
Sets the payment method to
cod
for Shiprocket -
Updates the shipment total to match only the remaining COD amount
Why This Is Important
By pushing the correct amount to Shiprocket, you:
Prevent overcharging the customer at delivery
Avoid delivery disputes and returns
Maintain clear, consistent accounting and logistics
One-Time Setup, Lifetime Accuracy
You only need to add this snippet once (via your child theme’s functions.php, a custom plugin, or a code snippet manager like WPCode), and it will handle all future orders that use the deposit system.
This works not only for Shiprocket but any shipping provider integrated with our plugin.
Streamline Your Shipping with Confidence
This feature is made possible by the flexibility built into our Shipment Tracker for WooCommerce plugin. We aim to simplify the complexities of eCommerce shipping—while giving you full control over what gets sent to your shipping providers.
Share this article
Follow us
A quick overview of the topics covered in this article.