# Shopify APIにおける在庫数の更新について

**URL:** <https://community.shopify.com/t/shopify-api/49621>\
**Category:** 技術的なQ＆A\
**Created:** [June 14, 2021, 7:06am UTC](https://community.shopify.com/t/shopify-api/49621 "2021-06-14T07:06:48Z")\
**Posts on this page:** 1\
**Page:** 1

## AI-generated summary

Shopify Admin API を使った在庫更新で、`inventory_quantity` を `0` に指定しても反映されず、レスポンスでは `1` のまま返る不具合が報告されている。対象は商品バリエーション更新のリクエストで、`inventory_management` は `shopify`、`inventory_policy` は `deny` に設定されている。

投稿時点の状況:
- 以前は正常に更新できていた
- 在庫変更系アプリを一時利用しており、その影響を疑って削除済み
- それでも在庫数が更新できない状態が継続

共有された内容:
- リクエスト JSON とレスポンス JSON が提示されている
- 中心的な論点は、在庫数を表す `inventory_quantity` が API 経由で書き換わらない原因

結論や解決策はまだ示されておらず、原因調査を求める段階。アプリ干渉の可能性は示唆されているが、未確定のまま。

<div class="post-metadata">

**Author:** ![IMD\_1](https://avatars.discourse-cdn.com/v4/letter/i/aeb1de/32.png) [@IMD\_1](https://community.shopify.com/u/IMD_1)\
**Post date:** [June 14, 2021, 7:06am UTC](https://community.shopify.com/t/shopify-api/49621/1 "2021-06-14T07:06:48Z")

</div>

Shopify のAPIを利用して在庫数を更新しているのですが、  
急に在庫数の更新ができなくなってしまいました。  
参考API資料：[https://shopify.dev/docs/admin-api/rest/reference/products/product?api%5Bversion%5D=2021-07](https://shopify.dev/docs/admin-api/rest/reference/products/product?api%5Bversion%5D=2021-07)

リクエストでは、在庫数を「０（inventory\_quantity = 0）」にしていますが、  
レスポンスでは在庫数が更新されず「１（inventory\_quantity = 1）」になっております。

一度在庫を変更できるアプリを利用していたので、そちらとの相性の問題かと思い  
削除しているのですが更新ができない状態です。  
※アプリを入れる前は正常に更新できていました。

こちらの原因について教えていただくことは可能でしょうか？  
お手数ですが、ご確認いただけますと幸いです。

【リクエスト内容】

～  
{  
“product\_id”: null,  
“title”: “モンクレール スニーカー MONCLER 4M729 00 02SR9 MILIENⅡ 1 ホワイト メンズ 2021年春夏新作 【GO】”,  
“sku”: “99025306-3000033373”,  
“position”: null,  
“grams”: null,  
“inventory\_policy”: “deny”,  
“fulfillment\_service”: null,  
“inventory\_item\_id”: null,  
“inventory\_management”: “shopify”,  
“price”: 53680,  
“compare\_at\_price”: 67100,  
“option1”: “ホワイト”,  
“option2”: “41（3000033373）”,  
“option3”: null,  
“taxable”: false,  
“tax\_code”: null,  
“requires\_shipping”: true,  
“barcode”: null,  
“inventory\_quantity”: 0,  
“weight”: 0,  
“weight\_unit”: “kg”,  
“metafields”: null,  
“presentment\_prices”: null,  
“id”: null,  
“admin\_graphql\_api\_id”: null  
}  
～

【レスポンス内容】

～  
{  
“product\_id”: ｛product\_id情報｝,  
“title”: “ホワイト / 41（3000033373）”,  
“sku”: “99025306-3000033373”,  
“position”: 2,  
“grams”: 0,  
“inventory\_policy”: “deny”,  
“fulfillment\_service”: “manual”,  
“inventory\_item\_id”: ｛inventory\_item\_id情報｝,  
“inventory\_management”: “shopify”,  
“price”: 53680,  
“compare\_at\_price”: 67100,  
“option1”: “ホワイト”,  
“option2”: “41（3000033373）”,  
“option3”: null,  
“created\_at”: “2021-05-06T16:04:35+09:00”,  
“updated\_at”: “2021-06-14T11:15:31+09:00”,  
“taxable”: false,  
“tax\_code”: null,  
“requires\_shipping”: true,  
“barcode”: null,  
“inventory\_quantity”: 1,  
“weight”: 0,  
“weight\_unit”: “kg”,  
“metafields”: null,  
“presentment\_prices”: null,  
“id”: ｛id情報｝,  
“admin\_graphql\_api\_id”: “｛admin\_graphql\_api\_id情報｝”  
},

～
