We are trying to create an order and apply a coupon code using woo commerce API as explained in the woo commerce documentation. following is the JSON we are trying to send with the API request.
{
"order":{
"payment_details":{"method_id":"cash","method_title":"cash","paid":false},
"billing_address":{"first_name":"kamran","last_name":"masud","company":null,"address_1":"Dubai Dubai - United Arab Emirates",
"address_2":null,"city":null,"state":null,"postcode":null,"country":null,"email":null,"phone":"541234566"},
"shipping_address":{"first_name":"kamran","last_name":"masud","company":null,"address_1":"Dubai Dubai - United Arab Emirates",
"address_2":null,"city":null,"state":null,"postcode":null,"country":null},
"customer_id":116,
"line_items":[
{"product_id":11734,"variation_id":0,"quantity":108,"total":"3834"},
{"product_id":10893,"variation_id":0,"quantity":1,"total":"206.56"},
{"product_id":11872,"variation_id":0,"quantity":1,"total":"41.49"},
{"product_id":11866,"variation_id":0,"quantity":1,"total":"53.17"},
{"product_id":11865,"variation_id":0,"quantity":1,"total":"53.17"},
{"product_id":11965,"variation_id":0,"quantity":1,"total":"47.81"},
{"product_id":11626,"variation_id":0,"quantity":1,"total":"323.73"},
{"product_id":11927,"variation_id":0,"quantity":1,"total":"144.3"}],
"shipping_lines":[],
"fee_lines":[
{"id":0,"title":"Shipping :","tax_class":null,"total":"0","total_tax":null}
],
"coupon_lines":[
{
"code":"fixedcart10",
"discount":"80",
"meta_data":[
{
"key":"coupon_data",
"value":[
{
"id":"168026",
"code":"fixedcart10",
"amount":"10"
}
]
}
]
}
],
"discount_total":null,
"shipping_total":null,
"total":null,"status":"processing"}}
coupon goes through with the order it doesn't get applied in the created order. following is the screenshot of the order created.
Any help would be appreciated.
thanks
question from:
https://stackoverflow.com/questions/65935258/create-order-with-coupon-lines-using-woocommerce-rest-api