Shopifyの注文データを別のツールに渡しています。
商品ごとの割引価格を取得したいのですが、
受け取る側のツールにはorder > order_line(line_itemsと同じと思われる)> total_discountとtotal_discount_setしかありません。
ドキュメントには以下のように記載があります。
- total_discount: The total amount of the discount allocated to the line item in the shop currency. This field must be explicitly set using draft orders, Shopify scripts, or the API. Instead of using this field, Shopify recommends using discount_allocations, which provides the same information.
- total_discount_set: The total amount allocated to the line item in the presentment currency. Instead of using this field, Shopify recommends using discount_allocations, which provides the same information.
https://shopify.dev/docs/api/admin-rest/2024-10/resources/order
ドキュメントの内容から、何もしない場合、これらの値は使用できないという認識をしています。
このtotal_discountやtotal_discount_setに値を持たせる方法があれば教えてください。
*discount_allocationsの使用を勧められていますが、データを受け取る側のツールが、discount_allocationsを受け取れません…
Shopify Flowの「orderEditAddLineItemDiscount」のミューテーションを使用し、既存の「discount_allocations」を取得して、新しくディスカウントを追加すると、total_discountの値は期待通りになったのですが、元のdiscount_allocationsの値にも追加されてしまいうまくいきませんでした。(orderEditAddLineItemDiscount というミューテーションなので、追加されるだけなのは当たり前なのですが… しかもorderEditDeleteLineItemDiscountがFlowの中にはありませんでした…)
Flowやその他のやり方で何か手段をご存知の方がいらっしゃいましたら教えてください。