shopify回传订单

已解决
ljl
新成员
29 0 0

通过该接口获取到shopify平台订单,如果我再次获取还会获取到相同的单子,如何回传订单状态,让已经获取到的单子无法获取到

1 个已接受解答

已接受的解答
Tim_Mak
探路者
97 11 12
解决方案

你如果通过fulfillment接口完成了订单,如果再次获取订单可以筛选出已经完成的订单

https://shopify.dev/api/admin-rest/2021-10/resources/order#[get]/admin/api/2021-10/orders.json

fulfillment_status

在原帖中查看解决方案

38 条回复38
Tim_Mak
探路者
97 11 12
解决方案

你如果通过fulfillment接口完成了订单,如果再次获取订单可以筛选出已经完成的订单

https://shopify.dev/api/admin-rest/2021-10/resources/order#[get]/admin/api/2021-10/orders.json

fulfillment_status

在原帖中查看解决方案

ljl
新成员
29 0 0

你好,请问如何称呼你

我的需求是这样的,我想通过接口获取shopify平台店铺的订单,然后通过我们系统提交出库发货获取面单后回传订单的状态,请问调用接口的具体顺序是什么?

我的理解是这样的:

ljl_0-1633914356663.png

 

1、获取草稿订单

url:https://8f212ed52efaced7890be4100cef075f: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@2248023813.myshopify...

resp body

{
    "draft_orders": [
        {
            "id"988427682025,
            "note""shopify测试",
            "email""2248023813@qq.com",
            "taxes_included"false,
            "currency""USD",
            "invoice_sent_at"null,
            "created_at""2021-10-08T10:39:08+08:00",
            "updated_at""2021-10-08T10:39:08+08:00",
            "tax_exempt"true,
            "completed_at"null,
            "name""#D3",
            "status""open",
            "line_items": [
                {
                    "id"57711735996649,
                    "variant_id"39466176053481,
                    "product_id"6635917770985,
                    "title""SHIRT",
                    "variant_title""10",
                    "sku""SHIRT",
                    "vendor""2248023813",
                    "quantity"1,
                    "requires_shipping"true,
                    "taxable"true,
                    "gift_card"false,
                    "fulfillment_service""manual",
                    "grams"454,
                    "tax_lines": [],
                    "applied_discount"null,
                    "name""SHIRT - 10",
                    "properties": [],
                    "custom"false,
                    "price""0.00",
                    "admin_graphql_api_id""gid://shopify/DraftOrderLineItem/57711735996649"
                }
            ],
            "shipping_address": {
                "first_name""hat",
                "address1""32801 Ecorse Road",
                "phone""+11234567890",
                "city""Romulus",
                "zip""48174",
                "province""Michigan",
                "country""United States",
                "last_name""liu",
                "address2""",
                "company""hat",
                "latitude"42.2505224,
                "longitude"-83.3622427,
                "name""hat liu",
                "country_code""US",
                "province_code""MI"
            },
            "billing_address": {
                "first_name""hat",
                "address1""32801 Ecorse Road",
                "phone""+11234567890",
                "city""Romulus",
                "zip""48174",
                "province""Michigan",
                "country""United States",
                "last_name""liu",
                "address2""",
                "company""hat",
                "latitude"42.2505224,
                "longitude"-83.3622427,
                "name""hat liu",
                "country_code""US",
                "province_code""MI"
            },
            "applied_discount"null,
            "order_id"null,
            "shipping_line"null,
            "tax_lines": [],
            "tags""紧急",
            "note_attributes": [],
            "total_price""0.00",
            "subtotal_price""0.00",
            "total_tax""0.00",
            "admin_graphql_api_id""gid://shopify/DraftOrder/988427682025",
            "customer": {
                "id"5244566962409,
                "email""2248023813@qq.com",
                "accepts_marketing"true,
                "created_at""2021-09-28T09:07:44+08:00",
                "updated_at""2021-09-28T09:07:44+08:00",
                "first_name""hat",
                "last_name""liu",
                "orders_count"0,
                "state""disabled",
                "total_spent""0.00",
                "last_order_id"null,
                "note"null,
                "verified_email"true,
                "multipass_identifier"null,
                "tax_exempt"true,
                "phone"null,
                "tags""",
                "last_order_name"null,
                "currency""USD",
                "accepts_marketing_updated_at""2021-09-28T09:07:44+08:00",
                "marketing_opt_in_level""single_opt_in",
                "tax_exemptions": [],
                "admin_graphql_api_id""gid://shopify/Customer/5244566962409",
                "default_address": {
                    "id"6433503346921,
                    "customer_id"5244566962409,
                    "first_name""hat",
                    "last_name""liu",
                    "company""hat",
                    "address1""32801 Ecorse Road",
                    "address2""",
                    "city""Romulus",
                    "province""Michigan",
                    "country""United States",
                    "zip""48174",
                    "phone""+11234567890",
                    "name""hat liu",
                    "province_code""MI",
                    "country_code""US",
                    "country_name""United States",
                    "default"true
                }
            }
        }
    ]
}
2、回传订单状态 此接口未调通
resp body:
{
    "errors""Change your plan to allow customers to checkout and to create orders."
}
 
 针对我目前的需求,请问调用的接口是否正确?
希望得到您的答复,谢谢

 

 

ljl
新成员
29 0 0

我的问题还没有问,方便回复我后面的疑问吗?

Tim_Mak
探路者
97 11 12

1. 你看的这块API是处理draft order,也就是定制订单,是商家自己创建的订单,不是客户下单的

2. 用的接口没有错,但因为是测试店铺,不是付费店铺,所以会出现这个错误

 

ljl
新成员
29 0 0

听起来你对这块业务很了解,感谢你的回复!

我还有个问题,请问这两个接口有何区别。针对我的业务需求,我应该调哪一个接口,谢谢

特别感谢

https://shopify.dev/api/admin-rest/2021-10/resources/order#[get]/admin/api/2021-10/orders.json

 

https://3ae227a45e2e8f939fac5e52c1a49eb0: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@3092237819.myshopify...

Tim_Mak
探路者
97 11 12

看到你们在另一个帖子的需求,你们应该用第一个接口:

https://shopify.dev/api/admin-rest/2021-10/resources/order#[get]/admin/api/2021-10/orders.json

你们有两个途径可以走:

第一个:

1. 获取订单:https://shopify.dev/api/admin-rest/2021-10/resources/order#[get]/admin/api/2021-10/orders.json 

2. 内部处理完订单去关闭所处理的订单:https://shopify.dev/api/admin-rest/2021-10/resources/order#[post]/admin/api/2021-10/orders/{order_id... 

3. 再次获取订单的时候已关闭的订单默认不会被拉取到

第二个:

1. 获取订单:https://shopify.dev/api/admin-rest/2021-10/resources/order#[get]/admin/api/2021-10/orders.json 

2. 去发货,给订单添加物流信息:https://shopify.dev/api/admin-rest/2021-10/resources/fulfillment#[post]/admin/api/2021-10/fulfillmen... 

3. 再次获取订单的时候,要传去fulfillment_status=shipped

 

ljl
新成员
29 0 0

我认为您提供的第二种方案符合我们的业务需求

我再简单解释一下

我们先获取到shopify平台店铺已创建的草稿订单。获取完成之后,我们会提交出库发货,会获取到每个订单的追踪号和与之对应的面单。这时,我们需要把订单回传回传到shopify平台店铺,当再次获取时就获取不到已发货的单子,我想问下面这种方案是否满足我的业务需求?这样就不需要调Complete a fulfillment接口了?

 

1. 获取订单:https://shopify.dev/api/admin-rest/2021-10/resources/order#[get]/admin/api/2021-10/orders.json 

2. 去发货,给订单添加物流信息:https://shopify.dev/api/admin-rest/2021-10/resources/fulfillment#[post]/admin/api/2021-10/fulfillmen... 

3. 再次获取订单的时候,要传去fulfillment_status=shipped

Tim_Mak
探路者
97 11 12

是的,没错,不需要Complete a fulfillment接口了

ljl
新成员
29 0 0

非常感谢,我明白了