Fulfillment Location - How to set FL of order/line items when creating an order?

ValleyEats
Shopify Partner
5 0 6

When I create an order through the REST_API I'd like to specify where the order is meant to be fulfilled. I thought creating pending fulfillments in the order would achieve this and in a way it did, however it also fulfilled the order which I don't want.

"order":
       {
            "email":"example@example.ca",
            "phone":"1-999-999-9999",
            "inventory_behaviour": "decrement_obeying_policy",
            "fulfillments":[
                {
                    "location_id":71703036117, 
                    "assigned_location_id":71703036117,
                    "fulfillment_status":null, 
                    "status":"pending", 
                    "request_status":"submitted",
                    "line_items":[
                        {
                            "variant_id":43775418335445,
                            "quantity":1,
                            "assigned_location_id":71703036117,
                            "fulfillment_status":null,
                            "status":"pending",
                            "fulfillable_quantity":1
                        }
                    ]
                }
            ],
            "line_items":[
                {
                    "variant_id":43775418335445,
                    "quantity":1,
                    "assigned_location_id":71703036117,
                    "origin_location":71703036117,
                    "location_id":71703036117,
                    "fulfillment_status":null,
                    "status":"pending",
                    "fulfillable_quantity":1
                }
            ],
            "fulfillment_status":null,
            "financial_status":"paid",
            "status":"pending",
            "metafields":[
                {"key":"readyTime","value":"2023-03-13T15:10:50+0000","type":"date_time","namespace":"text"},
                {"key":"orderId","value":"text","type":"single_line_text_field","namespace":"text"}
            ],
            "assigned_location_id":71703036117
        }

As you can see I've tried setting location and status every way that I can think and the only thing that has any effect is the fulfillments but the moment I add it the order auto fulfills on creation. If anyone has any suggestions they would be much appreciated.

 

Replies 3 (3)

RobZone
Shopify Staff
69 10 22

Since you are providing a variant_id, the location will be automatically assigned based on inventory.  If you want to use a different location, you can use the fulfillment order move operation to change it without fulfilling.  This cannot be assigned during order creation.

To learn more visit the Shopify Help Center or the Community Blog.

ValleyEats
Shopify Partner
5 0 6

This worked however the order appears in both locations POS system, is there a way to make the order only appear on the specified locations POS. I'm trying to have an online order placed for pickup and the vendor I'm working with primarily looks at the Shopify POS App not the Shopify App. Should I be using the Storefront API instead of the REST & GraphQL API's?

RobZone
Shopify Staff
69 10 22

You need to query the location on the fulfillment orders and use the fulfillment order move operation if it is assigned to the wrong one.  Yes, the admin APIs are the correct ones to use here.  Unfortunately, the order creation API does not allow you to specify a location.

To learn more visit the Shopify Help Center or the Community Blog.