Skip to content

Commit ec565cb

Browse files
Added docs about products/<id>/orders
1 parent dd1974e commit ec565cb

File tree

1 file changed

+341
-0
lines changed

1 file changed

+341
-0
lines changed

source/includes/v3/_products.md

+341
Original file line numberDiff line numberDiff line change
@@ -2402,3 +2402,344 @@ woocommerce.get("products/categories").parsed_response
24022402
<aside class="notice">
24032403
View the <a href="#product-category-properties">Product Category Properties</a> for more details on this response.
24042404
</aside>
2405+
2406+
## View List Of Product Orders ##
2407+
2408+
<div class="api-endpoint">
2409+
<div class="endpoint-data">
2410+
<i class="label label-get">GET</i>
2411+
<h6>/wc-api/v3/products/&lt;id&gt;/orders</h6>
2412+
</div>
2413+
</div>
2414+
2415+
```shell
2416+
curl https://example.com/wc-api/v3/products/546/orders \
2417+
-u consumer_key:consumer_secret
2418+
```
2419+
2420+
```javascript
2421+
WooCommerce.get('products/546/orders', function(err, data, res) {
2422+
console.log(res);
2423+
});
2424+
```
2425+
2426+
```python
2427+
print(wcapi.get("products/546/orders").json())
2428+
```
2429+
2430+
```ruby
2431+
woocommerce.get("products/546/orders").parsed_response
2432+
```
2433+
2434+
> JSON response example:
2435+
2436+
```json
2437+
{
2438+
"orders": [
2439+
{
2440+
"id": 645,
2441+
"order_number": 645,
2442+
"created_at": "2015-01-26T20:00:21Z",
2443+
"updated_at": "2015-07-31T11:45:12Z",
2444+
"completed_at": "2015-01-26T20:00:21Z",
2445+
"status": "processing",
2446+
"currency": "USD",
2447+
"total": "79.87",
2448+
"subtotal": "63.97",
2449+
"total_line_items_quantity": 3,
2450+
"total_tax": "5.90",
2451+
"total_shipping": "10.00",
2452+
"cart_tax": "5.40",
2453+
"shipping_tax": "0.50",
2454+
"total_discount": "0.00",
2455+
"shipping_methods": "Local Delivery",
2456+
"payment_details": {
2457+
"method_id": "bacs",
2458+
"method_title": "Direct Bank Transfer",
2459+
"paid": true
2460+
},
2461+
"billing_address": {
2462+
"first_name": "John",
2463+
"last_name": "Doe",
2464+
"company": "",
2465+
"address_1": "969 Market",
2466+
"address_2": "",
2467+
"city": "San Francisco",
2468+
"state": "CA",
2469+
"postcode": "94103",
2470+
"country": "US",
2471+
"email": "[email protected]",
2472+
"phone": "(555) 555-5555"
2473+
},
2474+
"shipping_address": {
2475+
"first_name": "John",
2476+
"last_name": "Doe",
2477+
"company": "",
2478+
"address_1": "969 Market",
2479+
"address_2": "",
2480+
"city": "San Francisco",
2481+
"state": "CA",
2482+
"postcode": "94103",
2483+
"country": "US"
2484+
},
2485+
"note": "",
2486+
"customer_ip": "127.0.0.1",
2487+
"customer_user_agent": "WordPress/4.1; http://example.com",
2488+
"customer_id": 2,
2489+
"view_order_url": "https://example.com/my-account/view-order/645",
2490+
"line_items": [
2491+
{
2492+
"id": 504,
2493+
"subtotal": "43.98",
2494+
"subtotal_tax": "4.40",
2495+
"total": "43.98",
2496+
"total_tax": "4.40",
2497+
"price": "21.99",
2498+
"quantity": 2,
2499+
"tax_class": "reduced-rate",
2500+
"name": "Premium Quality",
2501+
"product_id": 546,
2502+
"sku": "",
2503+
"meta": []
2504+
},
2505+
{
2506+
"id": 505,
2507+
"subtotal": "19.99",
2508+
"subtotal_tax": "1.00",
2509+
"total": "19.99",
2510+
"total_tax": "1.00",
2511+
"price": "19.99",
2512+
"quantity": 1,
2513+
"tax_class": null,
2514+
"name": "Ship Your Idea",
2515+
"product_id": 613,
2516+
"sku": "",
2517+
"meta": [
2518+
{
2519+
"key": "pa_color",
2520+
"label": "Color",
2521+
"value": "Black"
2522+
}
2523+
]
2524+
}
2525+
],
2526+
"shipping_lines": [
2527+
{
2528+
"id": 506,
2529+
"method_id": "flat_rate",
2530+
"method_title": "Local Delivery",
2531+
"total": "10.00"
2532+
}
2533+
],
2534+
"tax_lines": [
2535+
{
2536+
"id": 507,
2537+
"rate_id": "5",
2538+
"code": "US-CA-TAX-1",
2539+
"title": "Tax",
2540+
"total": "4.40",
2541+
"compound": false
2542+
},
2543+
{
2544+
"id": 508,
2545+
"rate_id": "4",
2546+
"code": "US-STANDARD-1",
2547+
"title": "Standard",
2548+
"total": "1.50",
2549+
"compound": false
2550+
}
2551+
],
2552+
"fee_lines": [],
2553+
"coupon_lines": [],
2554+
"customer": {
2555+
"id": 2,
2556+
"created_at": "2014-11-19T18:34:19Z",
2557+
"email": "[email protected]",
2558+
"first_name": "",
2559+
"last_name": "",
2560+
"username": "john.doe",
2561+
"last_order_id": "645",
2562+
"last_order_date": "2015-01-26T20:00:21Z",
2563+
"orders_count": 2,
2564+
"total_spent": "19.00",
2565+
"avatar_url": "https://secure.gravatar.com/avatar/ad516503a11cd5ca435acc9bb6523536?s=96",
2566+
"billing_address": {
2567+
"first_name": "John",
2568+
"last_name": "Doe",
2569+
"company": "",
2570+
"address_1": "969 Market",
2571+
"address_2": "",
2572+
"city": "San Francisco",
2573+
"state": "CA",
2574+
"postcode": "94103",
2575+
"country": "US",
2576+
"email": "[email protected]",
2577+
"phone": "(555) 555-5555"
2578+
},
2579+
"shipping_address": {
2580+
"first_name": "John",
2581+
"last_name": "Doe",
2582+
"company": "",
2583+
"address_1": "969 Market",
2584+
"address_2": "",
2585+
"city": "San Francisco",
2586+
"state": "CA",
2587+
"postcode": "94103",
2588+
"country": "US"
2589+
}
2590+
}
2591+
},
2592+
{
2593+
"id": 644,
2594+
"order_number": 644,
2595+
"created_at": "2015-01-26T19:33:42Z",
2596+
"updated_at": "2015-07-31T11:45:12Z",
2597+
"completed_at": "2015-01-26T19:33:42Z",
2598+
"status": "on-hold",
2599+
"currency": "USD",
2600+
"total": "44.14",
2601+
"subtotal": "30.99",
2602+
"total_line_items_quantity": 2,
2603+
"total_tax": "3.15",
2604+
"total_shipping": "10.00",
2605+
"cart_tax": "2.65",
2606+
"shipping_tax": "0.50",
2607+
"total_discount": "0.00",
2608+
"shipping_methods": "Flat Rate",
2609+
"payment_details": {
2610+
"method_id": "bacs",
2611+
"method_title": "Direct Bank Transfer",
2612+
"paid": false
2613+
},
2614+
"billing_address": {
2615+
"first_name": "John",
2616+
"last_name": "Doe",
2617+
"company": "",
2618+
"address_1": "969 Market",
2619+
"address_2": "",
2620+
"city": "San Francisco",
2621+
"state": "CA",
2622+
"postcode": "94103",
2623+
"country": "US",
2624+
"email": "[email protected]",
2625+
"phone": "(555) 555-5555"
2626+
},
2627+
"shipping_address": {
2628+
"first_name": "John",
2629+
"last_name": "Doe",
2630+
"company": "",
2631+
"address_1": "969 Market",
2632+
"address_2": "",
2633+
"city": "San Francisco",
2634+
"state": "CA",
2635+
"postcode": "94103",
2636+
"country": "US"
2637+
},
2638+
"note": "",
2639+
"customer_ip": "127.0.0.1",
2640+
"customer_user_agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.91 Safari/537.36",
2641+
"customer_id": 2,
2642+
"view_order_url": "https://example.com/my-account/view-order/644",
2643+
"line_items": [
2644+
{
2645+
"id": 499,
2646+
"subtotal": "21.99",
2647+
"subtotal_tax": "2.20",
2648+
"total": "21.99",
2649+
"total_tax": "2.20",
2650+
"price": "21.99",
2651+
"quantity": 1,
2652+
"tax_class": "reduced-rate",
2653+
"name": "Premium Quality",
2654+
"product_id": 546,
2655+
"sku": "",
2656+
"meta": []
2657+
},
2658+
{
2659+
"id": 500,
2660+
"subtotal": "9.00",
2661+
"subtotal_tax": "0.45",
2662+
"total": "9.00",
2663+
"total_tax": "0.45",
2664+
"price": "9.00",
2665+
"quantity": 1,
2666+
"tax_class": null,
2667+
"name": "Woo Album #4",
2668+
"product_id": 96,
2669+
"sku": "",
2670+
"meta": []
2671+
}
2672+
],
2673+
"shipping_lines": [
2674+
{
2675+
"id": 501,
2676+
"method_id": "flat_rate",
2677+
"method_title": "Flat Rate",
2678+
"total": "10.00"
2679+
}
2680+
],
2681+
"tax_lines": [
2682+
{
2683+
"id": 502,
2684+
"rate_id": "5",
2685+
"code": "US-CA-TAX-1",
2686+
"title": "Tax",
2687+
"total": "4.40",
2688+
"compound": false
2689+
},
2690+
{
2691+
"id": 503,
2692+
"rate_id": "4",
2693+
"code": "US-STANDARD-1",
2694+
"title": "Standard",
2695+
"total": "1.50",
2696+
"compound": false
2697+
}
2698+
],
2699+
"fee_lines": [],
2700+
"coupon_lines": [],
2701+
"customer": {
2702+
"id": 2,
2703+
"created_at": "2014-11-19T18:34:19Z",
2704+
"email": "[email protected]",
2705+
"first_name": "",
2706+
"last_name": "",
2707+
"username": "john.doe",
2708+
"last_order_id": "645",
2709+
"last_order_date": "2015-01-26T20:00:21Z",
2710+
"orders_count": 2,
2711+
"total_spent": "19.00",
2712+
"avatar_url": "https://secure.gravatar.com/avatar/ad516503a11cd5ca435acc9bb6523536?s=96",
2713+
"billing_address": {
2714+
"first_name": "John",
2715+
"last_name": "Doe",
2716+
"company": "",
2717+
"address_1": "969 Market",
2718+
"address_2": "",
2719+
"city": "San Francisco",
2720+
"state": "CA",
2721+
"postcode": "94103",
2722+
"country": "US",
2723+
"email": "[email protected]",
2724+
"phone": "(555) 555-5555"
2725+
},
2726+
"shipping_address": {
2727+
"first_name": "John",
2728+
"last_name": "Doe",
2729+
"company": "",
2730+
"address_1": "969 Market",
2731+
"address_2": "",
2732+
"city": "San Francisco",
2733+
"state": "CA",
2734+
"postcode": "94103",
2735+
"country": "US"
2736+
}
2737+
}
2738+
}
2739+
]
2740+
}
2741+
```
2742+
2743+
<aside class="notice">
2744+
View the <a href="#orders-properties">Order Properties</a> for more details on this response.
2745+
</aside>

0 commit comments

Comments
 (0)