Carrier service and multi-origin shipping: order of requests

Carrier service and multi-origin shipping: order of requests

Ulrich_Hem
Visitor
2 0 1

We our using our own custom carrier service to calculate shipping and our products are at two different locations, some at one, the rest at the other. So far we are getting a single request to the carrier service, so we can return the exact shipping options and rates that we want. However, when multi-origin shipping is activated, we get two separate requests, each without any information that a request for the other location was sent. (We have activated multi-origin in a dev store.) So, now we need to make sure that the shipping options are the same, so Shopify can combine them correctly but we can't really do that due to the lack of information.

 

I have implemented a solution that worked at first:

  • Cache the response to one of the requests in our DB.
  • Hold off on responding to the other request for a second to check for a matching cached request (based on a hash of the destination object). If we find a match, adjust the response.

This works for us because one location takes precedent over the other when it comes to shipping.

 

The problem is that this assumed that the request are sent in parallel but it seems that they are sent one after the other and the order is based on what kind of product is on top in the cart (i.e. was last added to it). The solution will only work for simultaneous request or if they are sent in the correct order.

 

Has anyone here had a similar issue? Or does anyone know how to fix the order of requests or force simultaneous requests?

 

Fortunately, this only affects very few of the orders we get.

Replies 2 (2)

Umiko
Shopify Staff
42 8 14

Hi @Ulrich_Hem 👋

 

Once the order is created, you should be able to query the order to see all it's associated fulfillment orders and assigned locations. Then using the `fulfillmentOrderMove` mutation, the fulfillment orders can be re-assigned to different locations as needed. We have a great guide to fulfillment order management that outlines the steps as well.

 

Hope that helps!

 

Umiko | API Support @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

Ulrich_Hem
Visitor
2 0 1

Thanks! This is an interesting solution, I'll keep it in mind. I had tried doing something like this with the REST API but couldn't quite get it to work as required.