我在shopify订单api中将location_id设置为null

时间:2018-08-02 10:33:40

标签: shopify shopify-app

我通过shopify管理员创建了一个订单,并添加了客户详细信息,当我执行orders.json api时,我得到了location_id =“ null”

现在我需要位置ID来更新履行状态。

如果可能的话,如何更新订单的位置ID。这是我在创建订单时的回复。

 {
"orders": [
    {
        "id": 568323571800,
        "email": "sample_test_123_gmail@gmail.com",
        "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 个答案:

答案 0 :(得分:1)

您可以从 /admin/api/2021-04/locations.json API 中找到 location_id。

你会得到这样的回复:

{
    "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
        }
    ]
}

答案 1 :(得分:0)

位置ID与您的库存相关。首先,请确保已为库存设置了位置。其次,确保将Shopify设置为您的库存管理提供商。如果现在为Shopify管理的商品创建订单,则可能会看到一个位置ID。您创建这样的草稿订单的测试可能还没有与Shopify地点完全集成?当您使用前端而非API预订订单时会发生什么?

答案 2 :(得分:0)

订单上的

location_id将返回null,除非该订单是从Shopify POS位置进行的,在这种情况下,它将返回与该位置关联的location_id

请参阅实现指南:https://help.shopify.com/en/api/guides/managing-fulfillments

答案 3 :(得分:0)

要按顺序获取locationId,需要在productCreate Mutation中传递带有位置ID和可用数量的库房库存输入,然后您将按顺序获取locationId。

.check {
  color: red;
}