【发布时间】:2018-03-18 15:03:10
【问题描述】:
我正在尝试通过 woocommerce rest api 在 android 应用程序中创建带有优惠券的订单。我可以获取优惠券信息,也可以创建订单,但不适用折扣。订单以原价创建!
没有优惠券一切正常。
这是来自 API 的订单响应(我从中删除了一些无用的数据)
{
"id": 23136,
"parent_id": 0,
"number": "23136",
"order_key": "wc_order_5aasdad3128608",
"created_via": "rest-api",
"version": "3.2.6",
"status": "pending",
"currency": "USD",
"date_created": "2018-03-18T17:14:17",
"date_created_gmt": "2018-03-18T13:44:17",
"date_modified": "2018-03-18T17:14:17",
"date_modified_gmt": "2018-03-18T13:44:17",
"discount_total": "0",
"discount_tax": "0",
"shipping_total": "0",
"shipping_tax": "0",
"cart_tax": "0",
"total": "67500",
"total_tax": "0",
"prices_include_tax": false,
"customer_id": 0,
"customer_ip_address": "",
"customer_user_agent": "",
"customer_note": "",
"billing": {
"first_name": "...",
"last_name": "...",
"company": "",
"address_1": "",
"address_2": "",
"city": "",
"state": "",
"postcode": "",
"country": "",
"email": "...",
"phone": "..."
},
"shipping": {
"first_name": "",
"last_name": "",
"company": "",
"address_1": "",
"address_2": "",
"city": "",
"state": "",
"postcode": "",
"country": ""
},
"payment_method": "...",
"payment_method_title": "...",
"transaction_id": "",
"date_paid": null,
"date_paid_gmt": null,
"date_completed": null,
"date_completed_gmt": null,
"cart_hash": "",
"meta_data": [],
"line_items": [
{
"id": 1792,
"name": "...",
"product_id": 22359,
"variation_id": 22361,
"quantity": 1,
"tax_class": "",
"subtotal": "67500",
"subtotal_tax": "0",
"total": "67500",
"total_tax": "0",
"taxes": [],
"meta_data": [
{
"id": 19325,
"key": "...",
"value": "..."
},
{
"id": 19326,
"key": "...",
"value": "..."
}
],
"sku": "",
"price": 67500
}
],
"tax_lines": [],
"shipping_lines": [],
"fee_lines": [],
"coupon_lines": [
{
"id": 1793,
"code": "10Code",
"discount": "10000.00",
"discount_tax": "0",
"meta_data": [
{
"id": 19329,
"key": "coupon_data",
"value": {
"amount": "10000.00",
"code": "10Code",
"date_created": "2018-03-12T19:05:11",
"date_created_gmt": "2018-03-12T15:35:11",
"date_modified": "2018-03-12T19:15:35",
"date_modified_gmt": "2018-03-12T15:45:35",
"description": "",
"discount_type": "fixed_cart",
"email_restrictions": [],
"exclude_sale_items": false,
"excluded_product_categories": [],
"excluded_product_ids": [],
"free_shipping": false,
"id": 20922,
"individual_use": true,
"limit_usage_to_x_items": 0,
"maximum_amount": "0.00",
"meta_data": [
{
"id": 469119,
"key": "slide_template",
"value": "default"
}
],
"minimum_amount": "0.00",
"product_categories": [],
"product_ids": [],
"usage_count": 1,
"usage_limit": 0,
"usage_limit_per_user": 1,
"used_by": [
"test@gnail.com"
]
}
}
]
}
],
"refunds": [],
"_links": {
"self": [
{
"href": "https://.../wp-json/wc/v2/orders/23136"
}
],
"collection": [
{
"href": "https://.../wp-json/wc/v2/orders"
}
]
}
}
有人知道为什么会这样吗? 提前致谢
【问题讨论】:
标签: android woocommerce woocommerce-rest-api