v1.6.0 - CreateShipment SOAP v2 call ships all items
-
16-10-2019 - |
Question
We want to update orders with shipment details from an external system. We have successfully done the basics, but need to be able to partially ship orders.
The API description appears to allow for this, http://www.magentocommerce.com/api/soap/sales/salesOrderShipment/sales_order_shipment.create.html and specfically:
Notes: The array of orderItemQty is used for partial shipment. To create shipment for all order items, you do not need to specify these attributes.
However the API appears to ignore this. It doesn't seem to matter if we populate it with all the items and 0 out the ones we don't want shipped or just exclude them entirely.
Has anyone else encountered this problem or had to create partial shipments via the API before?
Thanks
Solution
Looking at the Mage_Sales_Model_Order_Shipment_Api_V2
class you should use the following format for the itemsQty array (as in the WS-I compliance mode example):
array('order_item_id' => '8', 'qty' => '1');
If the array is missing the keys order_item_id
or qty
it will ignore the specified rows in the function _prepareItemQtyData
and when all rows are skipped the API will ship all items.