skip to Main Content

I created an order through shopify admin and added the customer details , when i executes the orders.json api , I’m getting location_id =”null”

Now i’m in need of location id to update the fulfillment status.

How to update the location id for an order if possible .This is my response when i created an order .

 {
"orders": [
    {
        "id": 568323571800,
        "email": "[email protected]",
        "closed_at": null,
        "created_at": "2018-08-02T15:41:06+05:30",
        "updated_at": "2018-08-02T15:46:06+05:30",
        "number": 9,
        "note": "",
        "token": "a666eb3aea251cc585afc006cbf5b315",
        "gateway": "Cash on Delivery (COD)",
        "test": false,
        "total_price": "200.00",
        "subtotal_price": "200.00",
        "total_weight": 100,
        "total_tax": "0.00",
        "taxes_included": false,
        "currency": "INR",
        "financial_status": "pending",
        "confirmed": true,
        "total_discounts": "0.00",
        "total_line_items_price": "200.00",
        "cart_token": null,
        "buyer_accepts_marketing": false,
        "name": "#1009",
        "referring_site": null,
        "landing_site": null,
        "cancelled_at": null,
        "cancel_reason": null,
        "total_price_usd": "2.92",
        "checkout_token": null,
        "reference": null,
        "user_id": 23090102360,
        "location_id": null,

4

Answers


  1. location ID is tied to your inventory. First off, ensure you have set a location for your inventory. Second, make sure Shopify is set as your inventory management provider. If you now create an order for items managed by Shopify, you might see a location ID. Your test of creating a draft order like that might also not be fully integrated yet with Shopify locations? What happens when you book an order using the front end and not the API?

    Login or Signup to reply.
  2. location_id on an order will return null unless the order is made from a Shopify POS location in which case it will return the location_id associated with that location.

    See the guide on fulfillments: https://help.shopify.com/en/api/guides/managing-fulfillments

    Login or Signup to reply.
  3. To get locationId in order, need to pass inventoryQuantities input with location id and available quantity in productCreate Mutation.Then You will get locationId in order

    {
      "input": {
         "title": "Demo Product",
         "descriptionHtml": "des",
         "productType": "type",
         "vendor": "vendor",
         "handle": "abc1",
         "tags": ["tag1", "tag2"],
         "variants": [
            {
              "title": "small",
              "price": 100,
              "compareAtPrice": 110,
              "position": 1,
              "inventoryQuantities": {
                  "availableQuantity": 100,
                  "locationId": "gid://shopify/Location/55274340513"
               },
              "inventoryItem": {
                 "cost": 200,
                 "tracked": true
               }
              }
          ]
       }
    }
    
    Login or Signup to reply.
  4. You can find location_id from the /admin/api/2021-04/locations.json API.

    You will get response like this:

    {
        "locations": [
            {
                "id": location_id,
                "name": "location_name",
                "address1": "location_address",
                "address2": null,
                "city": "Faisalabad",
                "zip": "38000",
                "province": "",
                "country": "PK",
                "phone": "",
                "created_at": "2021-02-25T15:34:18+05:00",
                "updated_at": "2021-02-25T15:34:20+05:00",
                "country_code": "PK",
                "country_name": "Pakistan",
                "province_code": null,
                "legacy": false,
                "active": true,
                "admin_graphql_api_id": "gid://shopify/Location/location_id",
                "localized_country_name": "Pakistan",
                "localized_province_name": null
            }
        ]
    }
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search