Hi again Felix,
We found another issue which is slightly different.
It concerns an order created with the API so I suspect it's a problem with the order data, but Shopify did let it through.
The order has a non zero order.total_discounts but it has no discount codes.
There are no discount applications. I guess it makes given your earlier comment that discount_codes.amount has precedence.
However, clearly, total_discounts was not calculated from discount_codes.amount, as you had also mentioned, and we end up with an inconsistent order.
The order id is 604345466923.
Hi Clement!
Good observation, discount_codes.amount has precendence when both are provided, but total_discounts can still be provided by clients even if there no actual discount on the order (total_discounts usually being the calculated sum of existing discounts). This has been the case for a long time as well as orders are usually imported "as is".
In best of worlds, clients should not be able to send total_discounts, but ignoring the field could be problematic.
We will come up with a solution and get back to you. One possibility I see would be to create a manual discount allocated across all line items if no discount is explicitly provided but total_discounts is.
Thanks for the reply Felix. That is so unfortunate :( - I really wish the Shopify Reference guide was a bit more cleat as to what data elements are read-only vs not - and in which operations, it would have saved me a lot of time.
Is Shopify Planing on making these APIs usable via the POST Order API any time soon?
Our integration of the Klarna Payments gateways uses the Shopify Checkout object to display order data (order total, discount, shipping, tax, etc.) on our hosted page and also to create the Klarna order. In order to accurately support orders with Automatic Discounts, we need the automatic discount data to be available on the Checkout object prior to the customer completing the order. Currently when a customer selects on of our gateways as a payment method, the customer is redirected to our hosted page, which uses the API data to display checkout prices. Currently Automatic Discount data is not available in the Checkout object at the point in time when the customer is redirected to our hosted page. As soon as the order is created in Shopify (which we create using the Shopify REST API), the Checkout object would then get updated with the discount data (in applied_discount field), but that is too late for our integration. If helpful, feel free to see the flow at our Klarna Shopify demo store. Can you help us determine how we access the Automatic Discount data prior to the customer placing the order? thanks!
User | Count |
---|---|
51 | |
20 | |
14 | |
11 | |
9 |