How to fulfill order depending upon customer location?

13 0 0
  1. I have two locations now for my fulfillment. One in UK and the other in Europe. In shopify they are set up as locations
  2. All products exist in both locations
  3. When a customer orders in the UK I want to fulfill the order from the UK -based inventory
  4. When customer orders in Europe I want to route to the Europe-based inventory
  5. I want this to be done automatically
  6. I may have the need to override step 3 and 4 at some point and divert the inventory. for example, a UK out of Europe or Europe orders out of UK.

    I've checked this thread but this only includes information about a certain app.
    I don't want to use any app.

    Is there any way to build a custom app for the scenario?

    I was planning to build an app which on each order creation updates it's fulfillment location automatically, by using FulfillmentOrder endpoint, but that's probably not a good solution because e.g. If a customer places an order from UK and his order gets fulfilled from US inventory (and UK inventory is empty) then there won't be any point in changing the fulfillment location later.