{"action":"opened","issue":{"url":"https://api.github.com/repos/Shopify/shopify_api/issues/446","repository_url":"https://api.github.com/repos/Shopify/shopify_api","labels_url":"https://api.github.com/repos/Shopify/shopify_api/issues/446/labels{/name}","comments_url":"https://api.github.com/repos/Shopify/shopify_api/issues/446/comments","events_url":"https://api.github.com/repos/Shopify/shopify_api/issues/446/events","html_url":"https://github.com/Shopify/shopify_api/issues/446","id":334299177,"node_id":"MDU6SXNzdWUzMzQyOTkxNzc=","number":446,"title":"Multi-location Inventory - orders returning location_id = null","user":{"login":"ashleyfulks","id":20684345,"node_id":"MDQ6VXNlcjIwNjg0MzQ1","avatar_url":"https://avatars1.githubusercontent.com/u/20684345?v=4","gravatar_id":"","url":"https://api.github.com/users/ashleyfulks","html_url":"https://github.com/ashleyfulks","followers_url":"https://api.github.com/users/ashleyfulks/followers","following_url":"https://api.github.com/users/ashleyfulks/following{/other_user}","gists_url":"https://api.github.com/users/ashleyfulks/gists{/gist_id}","starred_url":"https://api.github.com/users/ashleyfulks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ashleyfulks/subscriptions","organizations_url":"https://api.github.com/users/ashleyfulks/orgs","repos_url":"https://api.github.com/users/ashleyfulks/repos","events_url":"https://api.github.com/users/ashleyfulks/events{/privacy}","received_events_url":"https://api.github.com/users/ashleyfulks/received_events","type":"User","site_admin":false},"labels":[{"id":945803037,"node_id":"MDU6TGFiZWw5NDU4MDMwMzc=","url":"https://api.github.com/repos/Shopify/shopify_api/labels/support","name":"support","color":"9353f4","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-06-21T00:56:33Z","updated_at":"2018-06-21T00:56:33Z","closed_at":null,"author_association":"NONE","body":"### Problem\r\n\r\nMerchant/App developer of \"Orderhive Inventory Management\" is testing their API calls with new multi-location inventory and seeing some results returning `location_id=null`. Location_id is required for \"fulfillment API\" which is causing some problems for these developers who are trying to adjust their inventory through their app.\r\n\r\n### Scope\r\n\r\nPotentially any shop using multi-location inventory\r\n\r\n### Examples\r\n\r\n[This product](https://multiple-location-test.myshopify.com/admin/products/1420391841850) returns a `location_id = null`  -  when creating a draft order here -https://multiple-location-test.myshopify.com/admin/orders/548278435898\r\n\r\nTested with 4 orders on their store (with their permission)\r\n\r\n[Draft Order](https://multiple-location-test.myshopify.com/admin/orders/551584956474) created with customer - fulfilled from 202-203, Baleshwar Avenue, Opp. Rajpath Club - result location_id = null\r\n[Draft Order](https://multiple-location-test.myshopify.com/admin/orders/551588167738) created with customer - fulfilled from New York - result location_id = null\r\n[Draft Order](https://multiple-location-test.myshopify.com/admin/orders/551590658106) created without customer - fulfilled from Vastrapur - result location_id = 10656907322\r\n[Draft Order](https://multiple-location-test.myshopify.com/admin/orders/551592951866) created with customer - fulfilled from Vastrapur - result location_id = null\r\n\r\nSo it appears that if there is no shipping location on the order - the location_id = fulfillment location\r\nand if there is a customer then location_id = null for this product\r\n\r\nThe developers provided us with this information which may be useful:\r\n```\r\nAPI key : d67db43c03e9a0cf63a6ea09ce294122\r\n\r\nRequest URI: GET /admin/orders/548278435898.json\r\n\r\nRequest Headers :\r\nX-Shopify-Access-Token : b32dc14549a37f4b2154ef2e4a7acf36\r\n\r\nResponse Body: {\r\n    \"order\": {\r\n        \"id\": 548278435898,\r\n        \"email\": \"peter.smith@mailinator.com\",\r\n        \"closed_at\": null,\r\n        \"created_at\": \"2018-06-13T23:40:12-04:00\",\r\n        \"updated_at\": \"2018-06-13T23:40:12-04:00\",\r\n        \"number\": 4,\r\n        \"note\": \"\",\r\n        \"token\": \"9ec398bc8de79e9c42caef7ae65887f3\",\r\n        \"gateway\": \"manual\",\r\n        \"test\": false,\r\n        \"total_price\": \"56000.00\",\r\n        \"subtotal_price\": \"56000.00\",\r\n        \"total_weight\": 175,\r\n        \"total_tax\": \"0.00\",\r\n        \"taxes_included\": false,\r\n        \"currency\": \"INR\",\r\n        \"financial_status\": \"paid\",\r\n        \"confirmed\": true,\r\n        \"total_discounts\": \"0.00\",\r\n        \"total_line_items_price\": \"56000.00\",\r\n        \"cart_token\": null,\r\n        \"buyer_accepts_marketing\": false,\r\n        \"name\": \"#1004\",\r\n        \"referring_site\": null,\r\n        \"landing_site\": null,\r\n        \"cancelled_at\": null,\r\n        \"cancel_reason\": null,\r\n        \"total_price_usd\": \"828.81\",\r\n        \"checkout_token\": null,\r\n        \"reference\": null,\r\n        \"user_id\": 16353919034,\r\n        \"location_id\": null,\r\n        \"source_identifier\": null,\r\n        \"source_url\": null,\r\n        \"processed_at\": \"2018-06-13T23:40:12-04:00\",\r\n        \"device_id\": null,\r\n        \"phone\": null,\r\n        \"customer_locale\": null,\r\n        \"app_id\": 1354745,\r\n        \"browser_ip\": null,\r\n        \"landing_site_ref\": null,\r\n        \"order_number\": 1004,\r\n        \"discount_applications\": [],\r\n        \"discount_codes\": [],\r\n        \"note_attributes\": [],\r\n        \"payment_gateway_names\": [\r\n            \"manual\"\r\n        ],\r\n        \"processing_method\": \"manual\",\r\n        \"checkout_id\": null,\r\n        \"source_name\": \"shopify_draft_order\",\r\n        \"fulfillment_status\": null,\r\n        \"tax_lines\": [],\r\n        \"tags\": \"\",\r\n        \"contact_email\": \"peter.smith@mailinator.com\",\r\n        \"order_status_url\": \"https://checkout.shopify.com/10388340794/orders/9ec398bc8de79e9c42caef7ae65887f3/authenticate?key=e38d45ced18e517c8d3d6281ffa3a851\",\r\n        \"admin_graphql_api_id\": \"gid://shopify/Order/548278435898\",\r\n        \"line_items\": [\r\n            {\r\n                \"id\": 1356707528762,\r\n                \"variant_id\": 13206258155578,\r\n                \"title\": \"Apple iPhone-X 256 GB\",\r\n                \"quantity\": 1,\r\n                \"price\": \"56000.00\",\r\n                \"sku\": \"APPLEIPHONEX\",\r\n                \"variant_title\": null,\r\n                \"vendor\": \"multiple-location-test\",\r\n                \"fulfillment_service\": \"manual\",\r\n                \"product_id\": 1420391841850,\r\n                \"requires_shipping\": true,\r\n                \"taxable\": true,\r\n                \"gift_card\": false,\r\n                \"name\": \"Apple iPhone-X 256 GB\",\r\n                \"variant_inventory_management\": \"shopify\",\r\n                \"properties\": [],\r\n                \"product_exists\": true,\r\n                \"fulfillable_quantity\": 1,\r\n                \"grams\": 175,\r\n                \"total_discount\": \"0.00\",\r\n                \"fulfillment_status\": null,\r\n                \"discount_allocations\": [],\r\n                \"admin_graphql_api_id\": \"gid://shopify/LineItem/1356707528762\",\r\n                \"tax_lines\": []\r\n            }\r\n        ],\r\n        \"shipping_lines\": [],\r\n        \"billing_address\": {\r\n            \"first_name\": \"Alex\",\r\n            \"address1\": \"342 Park Avenue\",\r\n            \"phone\": \"\",\r\n            \"city\": \"New York\",\r\n            \"zip\": \"10154\",\r\n            \"province\": \"New York\",\r\n            \"country\": \"United States\",\r\n            \"last_name\": \"Gmar\",\r\n            \"address2\": \"Time Square Street\",\r\n            \"company\": \"\",\r\n            \"latitude\": null,\r\n            \"longitude\": null,\r\n            \"name\": \"Alex Gmar\",\r\n            \"country_code\": \"US\",\r\n            \"province_code\": \"NY\"\r\n        },\r\n        \"shipping_address\": {\r\n            \"first_name\": \"Alex\",\r\n            \"address1\": \"345 Park Avenue\",\r\n            \"phone\": \"\",\r\n            \"city\": \"New York\",\r\n            \"zip\": \"10154\",\r\n            \"province\": \"New York\",\r\n            \"country\": \"United States\",\r\n            \"last_name\": \"Smith\",\r\n            \"address2\": \"Time Square Street\",\r\n            \"company\": \"\",\r\n            \"latitude\": 40.7579261,\r\n            \"longitude\": -73.972213,\r\n            \"name\": \"Alex Smith\",\r\n            \"country_code\": \"US\",\r\n            \"province_code\": \"NY\"\r\n        },\r\n        \"fulfillments\": [],\r\n        \"refunds\": [],\r\n        \"customer\": {\r\n            \"id\": 669840932922,\r\n            \"email\": \"peter.smith@mailinator.com\",\r\n            \"accepts_marketing\": false,\r\n            \"created_at\": \"2018-06-08T05:34:43-04:00\",\r\n            \"updated_at\": \"2018-06-14T00:39:39-04:00\",\r\n            \"first_name\": \"Alex\",\r\n            \"last_name\": \"Gmar\",\r\n            \"orders_count\": 2,\r\n            \"state\": \"disabled\",\r\n            \"total_spent\": \"112000.00\",\r\n            \"last_order_id\": 548331323450,\r\n            \"note\": \"\",\r\n            \"verified_email\": true,\r\n            \"multipass_identifier\": null,\r\n            \"tax_exempt\": false,\r\n            \"phone\": \"+919898098980\",\r\n            \"tags\": \"\",\r\n            \"last_order_name\": \"#1005\",\r\n            \"admin_graphql_api_id\": \"gid://shopify/Customer/669840932922\",\r\n            \"default_address\": {\r\n                \"id\": 723244974138,\r\n                \"customer_id\": 669840932922,\r\n                \"first_name\": \"Alex\",\r\n                \"last_name\": \"Smith\",\r\n                \"company\": \"\",\r\n                \"address1\": \"345 Park Avenue\",\r\n                \"address2\": \"Time Square Street\",\r\n                \"city\": \"New York\",\r\n                \"province\": \"New York\",\r\n                \"country\": \"United States\",\r\n                \"zip\": \"10154\",\r\n                \"phone\": \"\",\r\n                \"name\": \"Alex Smith\",\r\n                \"province_code\": \"NY\",\r\n                \"country_code\": \"US\",\r\n                \"country_name\": \"United States\",\r\n                \"default\": true\r\n            }\r\n        }\r\n    }\r\n}\r\n\r\nResponse Headers:\r\nAlt-Svc : clear\r\nConnection : keep-alive\r\nContent-Encoding : gzip\r\nContent-Security-Policy : default-src 'self' data: blob: 'unsafe-inline' 'unsafe-eval' https://* shopify-pos://*; block-all-mixed-content; child-src 'self' https://* shopify-pos://*; connect-src 'self' wss://* https://*; script-src https://cdn.shopify.com https://checkout.shopifycs.com https://js-agent.newrelic.com https://bam.nr-data.net https://dme0ih8comzn4.cloudfront.nethttps://api.stripe.com https://mpsnare.iesnare.com https://appcenter.intuit.com https://www.paypal.com https://maps.googleapis.com https://stats.g.doubleclick.net https://www.google-analytics.com https://visitors.shopify.com https://v.shopify.com https://widget.intercom.io https://js.intercomcdn.com 'self' 'unsafe-inline' 'unsafe-eval'; upgrade-insecure-requests; report-uri /csp-report?source%5Baction%5D=show&source%5Bapp%5D=Shopify&source%5Bcontroller%5D=admin%2Forders&source%5Bsection%5D=admin_api&source%5Buuid%5D=2260945b-96e6-4262-9400-b0f4606b3161\r\nContent-Type : application/json; charset=utf-8\r\nDate : Thu, 14 Jun 2018 10:27:41 GMT\r\nHTTP_X_SHOPIFY_SHOP_API_CALL_LIMIT : 1/40\r\nReferrer-Policy : origin-when-cross-origin\r\nServer : nginx\r\nStrict-Transport-Security : max-age=7889238\r\nTransfer-Encoding : chunked\r\nVary : Accept-Encoding\r\nVia : 1.1 google\r\nX-Content-Type-Options : nosniff\r\nX-Content-Type-Options : nosniff\r\nX-Dc : chi2,gcp-us-east1\r\nX-Download-Options : noopen\r\nX-Frame-Options : DENY\r\nX-Permitted-Cross-Domain-Policies : none\r\nX-Request-Id : 2260945b-96e6-4262-9400-b0f4606b3161\r\nX-ShardId : 57\r\nX-ShopId : 10388340794\r\nX-Shopify-Shop-Api-Call-Limit : 1/40\r\nX-Sorting-Hat-FeatureSet : default\r\nX-Sorting-Hat-PodId : 57\r\nX-Sorting-Hat-PodId-Cached : 0\r\nX-Sorting-Hat-PrivacyLevel : default\r\nX-Sorting-Hat-Section : pod\r\nX-Sorting-Hat-ShopId : 10388340794\r\nX-Sorting-Hat-ShopId-Cached : 0\r\nX-Stats-ApiClientId : 1063890\r\nX-Stats-ApiPermissionId : 78689632314\r\nX-Stats-UserId : 0\r\nX-XSS-Protection : 1; mode=block; report=/xss-report?source%5Baction%5D=show&source%5Bapp%5D=Shopify&source%5Bcontroller%5D=admin%2Forders&source%5Bsection%5D=admin_api&source%5Buuid%5D=2260945b-96e6-4262-9400-b0f4606b3161\r\n```\r\n\r\nThe problem with response is that 'location_id' is null in response. We are expecting 'location_id' in response to handle inventory adjustment in our app.\r\nWe also want 'location_id' for creating fullfillments because as per shopify docs, 'location_id' is required when creating fulfillments(afetr 1st July).\r\n\r\nHow do we determine at which location order was placed if 'location_id' is null?\r\n\r\nThere is another issue with this order(in the case where 'location_id' is null in order response). If we specify any 'location_id' while creating fulfillment for this order, shopify gives 404 ERROR and if we don't specify 'location_id', shopify creates fulfillment successfully.\r\n\r\n### Expected Vs Actual\r\n\r\nExpected - when order is fulfilled the location_id on the order would represent the location_id of the fulfillment center\r\nActual - when this order is fulfilled the location_id is `null` and therefore the app cannot adjust inventory levels.\r\n\r\n### Replication Steps\r\n\r\nCreated a draft order on the store for [this product](https://multiple-location-test.myshopify.com/admin/products/1420391841850) and go through the `mark as paid` and then `fulfill` the order from an inventory location. After creating the order check the `location_id`.\r\n\r\n### More Information\r\n\r\nThe inventory amounts seem to be incoming only and they are selling from that. There is no available inventory, perhaps that has to do with the empty `location_id`?\r\n![image](https://slack-imgs.com/?c=1&url=https%3A%2F%2Fscreenshot.click%2Ff12mr-2018-06-15_15-11-33.jpg)\r\n\r\nApparently if they create a product, then fill an order right away the `location_id` also returns `null`. If you want about 3 minutes then create an order the location_id works as it should.\r\n\r\nThe merchant said it's fine to create test orders on this store as it's designed for testing only.\r\n\t\r\n[Zendesk Ticket](https://shopify.zendesk.com/agent/tickets/9391902)\r\n\t\r\n@Shopify/api \r\n@Shopify/merchandising \r\n"}}
{"actor":{"display_login":"ashleyfulks"}}