I have made some modifications to a third party shipping module (Webshopapps_UsaShipping, fedex) so that I can base shipping costs on the origin of which warehouse will ship the item. This is working fine.
My issue is when I put two items in the cart and change the quantity of at least one of the items to more than one, collectRates gets called twice and the results of are added together.
For instance, if my cart contains:
SKU1 , Qnty 2, 56lbs each SKU2 , Qnty 1, 45lbs each
CollectRates is called twice. Each time it's called, the collectRates comes up with the same exact rates, but the results of each call are added together doubling the shipping. I have dumped and compared the $request that is sent to collectRates each time. I have also compared the response returned by collectRates when there is only one of each item in the cart. The returned objects are exactly the same except for the costs (I was trying to rule out maybe not passing something back to indicate the shipment is complete).
But the request sent to CollectRates is different the first and second time it's called: The first request has
[package_weight] => 101
The second one has
[package_weight] => 56
It split it into two shipments, one of each item, and the balance of the qnty 2 item.
I am not understanding this because the rest of the request is correct, and has both cart items listed with proper quantities and individual weights.
Any idea why the system would split the shipment before sending it to collectRates (the shipping module already splits the shipment as per configuration rules)?
I'm also wondering if it's caused by another extension or default behavior of the magento system. I've googled and haven't found anything that indicated the stock magento install would call collectRates more than once for the same cart contents. (Yes it can be called more than once when calculating cart totals, but it's only called once for the cart contents, not split like we are seeing here.)