2016-09-22 16 views
2

Python APIを使用して新しい配送先住所を追加する際に問題が発生しています。Shopify + Pythonライブラリ:新しい配送先住所を作成する方法

私はcustomer_idを持っていると仮定します。

この目標を達成するために正しいコード行を入れる方法が見つかりませんでした。 私はshopify testsフォルダを検索しましたが、そのような例は見つかりませんでした。

誰かが正しい方向に向かうことができますか?

+0

あなたの使用していますPythonの公式の[ShopifyAPI](https://github.com/Shopify/shopify_python_api)ライブラリですか? – jrbedard

+0

はい...住所を追加する方法が見つかりませんでした – embedded

答えて

0

公式のpython Shopify APIクライアントに実装何CustomerAddressリソースが現在ありませんが、あなたは回避策としてCustomerリソースのaddresses属性に直接アドレス情報を付加することができます

customer_id = 1234567890 

new_address = { 
    "address1": "123 Main Street", 
    "address2": "#5", 
    "city": "New York", 
    "company": "", 
    "country": "United States", 
    "name": "John Smith", 
    "phone": "", 
    "province": "New York", 
    "zip": "10001" 
} 

customer = shopify.Customer.find(customer_id) 
customer.addresses.append(new_address) 
customer.save() 
関連する問題