I am trying to create an order on my WooCommerce store from my mobile application using the REST API v2. The order is created successfully but I can't find any solution to the following issues.
- I send a
coupon_lines
array within theorder
object and when the order is viewed on the admin panel, it shows the coupon there but the ordertotal
is not affected at all. - Then I decided to calculate the
total
and discounts based on the applied coupon manually. I tried to setdiscount_total
within theorder
object equal to the amount which is the value of the coupon. I also update thetotal
manually as well. But again, all the values that I pass are ignored and the ordertotal
is equal to the sum of the prices of all line items (ignoringdiscount_total
).
Here is a sample JSON object that is sent to the API from my app.
What other options do I have to set an order total and discount manually? Any suggestions are welcome.