Order re-ship through API

Hi SH Team!

Hope everything is OK. I’m trying to automate the order cancellation process.

Actually, we can cancel orders through the API, but this only works if they are not fulfilled. In other case, it says that the order already has shipping labels which is OK. But sometimes we have to cancel orders that have been already shipped. So we call Re-ship on the UI, and then cancel the order through the API.

Is there a way to call order re-ship through the API? or maybe some other process to emulate this, like creating a return? The requirement is that the inventory has to be restored after the order gets cancelled.

Hey @marioreinike,

Thanks for reaching out.
There is no way to call the reship field through the Public API, but there might be a work around like you said. I’ll look into this and get back to you.

Best,
RayanP

Hi @sh-agent !

Did you come up with some work around for this issue?

Maybe you could help me here, what are the operations that are performed when Re-ship gets called?

I think it could be something like the following:

  1. Void shipping label / cancel shipment (Is this possible through API??)
  2. Change items fulfillment status to pending
  3. Set the corresponding quantity pending fulfillment
  4. change order status to pending
  5. add the corresponding inventory

Hey @marioreinike,

Apologies for the delay here. You’re pretty much spot on.

To mimic the “reset” of an order when being reshipped the operations being called would be:

  1. Change the order fulfillment status using order_update_fulfillment_status

  2. Update the fulfillment status of line items to pending and the quantity pending fulfillment. This can be done at the same time using the order_update_line_items mutation

Voiding the label(s) and re-adding the inventory are not necessarily done on every order that you reship, so I believe they are more conditional. If adding back inventory use the inventory_add mutation. The problem as you’ve found is that you cannot void a label through the API.

Please let me know if you have any questions or concerns.

Best,
RayanP

OK @sh-agent I understand. The only problem is that we are trying to automate this process, so, if voiding the shipping labels is not possible from the API then it is not convenient to do this at all.

Is it possible to make a feature request to void/delete the shipping labels through the API? I don’t think it’s a lot of work because it is already possible to create them.

The other way is to use returns. Is it possible to create a return in Shiphero from the API, and process it in the warehouse to restore the inventory? I am just looking for a way to cancel an order that has already been shipped.

Hey @marioreinike,

Thanks for hanging in there.

I’ve passed on your feedback regarding adding the shipment_void mutation to the Public API.

I’m not sure how the return would help here because it wouldn’t void any previous labels or set the order to canceled. In either case wouldn’t it be easier to use the inventory_add mutation to restore the inventory?

Let me know if I misunderstood anything!

Best,
Rayanp

mmmmm…

I was thinking that the return would work, because I could just skip the part of voiding the previous labels, since it would just restore the inventory, but I don’t know really how do returns work, we haven’t used them yet.

Ok I belive using the inventory_add mutation might work. The only problem here is that our system doesn’t know anything about the warehouse locations, so I couldn’t specify the one I want to restore the inventory at. I would like to restore the inventory in the same location that it was before. Is there a way to do that?

Also, please @sh-agent let me know if the requirement is going to be implemented! It would be very nice for us!

1 Like

Hey @marioreinike,

Thanks for hanging in there.

Through inventory_add you’re able to input a location, however the warehouse_id is a required field. To my understanding this wouldn’t work for you?

warehouse_product_update is another potential mutation but that as well requires the warehouse_id

Please let me know if you have any questions or concerns.

Best,
RayanP

We have the warehouse_id so there is no problem, but if we call the mutation without specifying the location, to which one it will be assigned to?

Hey @marioreinike,

Thanks for hanging in there.

When using inventory_add without specifying a location, the quantity is sent to the “Unassigned” location.

For example, I added 1 quantity to a test SKU that already had 29 stock in a location, and this is what happened:

Please let me know if you have any questions or concerns.

Best,
RayanP

Ok @sh-agent , this is not good for us because the products should be reinstalled in the location that they were before, just as in the Re-Ship functionality of the Shiphero App.

I think that the only way that we can work this out is that you exposed the Re-ship operation in the public API so we could use it.

Please let me know if you will develop this. Regards,

Mario

Hey @marioreinike,

Thanks for hanging in there!
I’ll let you know when progress is made on that front.

Please let me know if there’s anything I can do to assist in the meantime.

Best,
RayanP