如何使用python api编辑shopify履行

时间:2016-06-25 06:48:19

标签: python api shopify

如何使用shopify python api在现有shopify履行中添加跟踪号和跟踪网址。

代码:

token = <token>
session = shopify.Session("<shop-name>.myshopify.com", token)
shopify.ShopifyResource.activate_session(session)
a = shopify.Fulfillment.find(2642971265,order_id = 3386372225)
a.tracking_url = "www.example.com/trackingid=123"
a.tracking_number = "1234"
shopify.Fulfillment.save(a)

之后它返回true但更改没有反映在任何地方

1 个答案:

答案 0 :(得分:1)

我忘了添加其他细节,即tracking_urls和tracking_numbers

a = shopify.Fulfillment.find(order_id = 3386116225)[0]
a.tracking_company = "pickrr"
a.tracking_number = '12345678'
l = []
l.append('12345678')
a.tracking_numbers = l
a.tracking_url = "pickrr.com/12345678"
l = []
l.append("pickrr.com/12345678")
a.tracking_urls = l
shopify.Fulfillment.save(a)

现在一切正常