magento2: Rest salesShipOrderV1 API w/ Bundles error: "You can't create a shipment without products"
Preconditions
- Magento v2.1.4
Steps to reproduce
- Create an order containing a bundle of multiple simple products.
- Call the REST salesShipOrderV1 API (POST /V1/order/{orderId}/ship) and send a shipment for the individual items. Example:
{
"appendComment": 1,
"notify": 1,
"comment": {
"comment": "Your order has been shipped, login to view tracking information.",
"is_visible_on_front": 1
},
"items": [
{
"order_item_id": 516,
"qty": 1
},
{
"order_item_id": 517,
"qty": 1
}
],
"tracks": [
{
"title": "Netherlands Post Ground Parcel",
"carrier_code": "custom",
"track_number": "3SCEMW182389201"
}
]
}
Expected result
- Order gets mark completed
Actual result
{
"status": 400,
"headers": {},
"body": {
"message": "Shipment Document Validation Error(s):\nYou can't create a shipment without products."
}
}
Additional info
Reproduced it via Swagger. Applied admin token and used the POST/V1/order/{orderId}/ship Used the following query body
{
"items": [
{
"extension_attributes": {},
"order_item_id": 6,
"qty": 1
}
],
"notify": true,
"appendComment": true,
"comment": {
"extension_attributes": {},
"comment": "Your order has been shipped, login to view tracking information.",
"is_visible_on_front": 1
},
"tracks": [
{
"extension_attributes": {},
"track_number": "3SCEMW182389201",
"title": "Netherlands Post Ground Parcel",
"carrier_code": "fixed"
}
],
"packages": [
{
"extension_attributes": {}
}
],
"arguments": {
"extension_attributes": {}
}
}
Where :
- orderId can be found in Sales - Orders
- track_number is set while Shiping the order
Add a tracking number
- order_item_id I’m sure that there is an easier way, but I used GraphQL to verify the order item id
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 31 (2 by maintainers)
Commits related to this issue
- MC-30348: Rest salesShipOrderV1 API w/ Bundles error: "You can't create a shipment without products" magento/magento2#9762 — committed to engcom-Golf/magento2 by deleted user 4 years ago
- MC-30348: Rest salesShipOrderV1 API w/ Bundles error: "You can't create a shipment without products" magento/magento2#9762 — committed to engcom-Golf/magento2 by deleted user 4 years ago
- MC-30348: Rest salesShipOrderV1 API w/ Bundles error: "You can't create a shipment without products" magento/magento2#9762 — committed to engcom-Golf/magento2 by deleted user 4 years ago
- MC-30348: Rest salesShipOrderV1 API w/ Bundles error: "You can't create a shipment without products" magento/magento2#9762 — committed to engcom-Golf/magento2 by deleted user 4 years ago
- MC-30348: Rest salesShipOrderV1 API w/ Bundles error: "You can't create a shipment without products" magento/magento2#9762 — committed to engcom-Golf/magento2 by deleted user 4 years ago
- MC-30348: Rest salesShipOrderV1 API w/ Bundles error: "You can't create a shipment without products" MC-30348: Rest salesShipOrderV1 API w/ Bundles error: "You can't create a shipment without product... — committed to engcom-Golf/magento2 by deleted user 4 years ago
Hello,
I’m curious myself when this issue will be solved?
Kind regards, Reijer
Just tested this, and yes, it seems you have to pass the
parent_item_id
if the product is a child of a configurable product, otherwise you get an errorsee code example:
This should definitely be fixed, since logically it would make sense to create shipments for the single product and not the configurable product.
Hi everyone, this is the solution:
{ “appendComment”: true, “notify”: true, “comment”:{
“comment”:“shipment creado via webservice”, “is_visible_on_front”:1 },
}
remove items, it worked for me.
I have recently determined that the item visibility has something to do with this issue. One of my clients has items that are only visible via sku search and I can not add tracking to these items.
If possible the actual error logs sometimes have more information. You normally need access to the server to see these but it could offer insights
Dan
Sent from my iPhone
As a shipper I’m physically shipping the individual simple products, not the bundle SKU. The bundle SKU is just a virtual SKU representing the simple products. So I’m just telling Magento 2 what was actually shipped. It seems Magento 2 should be able to handle this and be smart enough to know once all the simple products are shipped then the bundle is shipped also. This is how it works in Magento 1 when sending shipments. We only ever send shipments for simple products and it works just fine.
How would we handle the scenario where the simple products were shipped separately? Each would have their own tracking number. If we can only mark the virtual bundle sku as shipped then it seems this scenario could not be handled.
Thanks.