Get specific order details
curl --request GET \
--url {protocol}://{host}/wp-json/cocart/preview/my-account/orders/{id}import requests
url = "{protocol}://{host}/wp-json/cocart/preview/my-account/orders/{id}"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('{protocol}://{host}/wp-json/cocart/preview/my-account/orders/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "{protocol}://{host}/wp-json/cocart/preview/my-account/orders/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{protocol}://{host}/wp-json/cocart/preview/my-account/orders/{id}"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("{protocol}://{host}/wp-json/cocart/preview/my-account/orders/{id}")
.asString();require 'uri'
require 'net/http'
url = URI("{protocol}://{host}/wp-json/cocart/preview/my-account/orders/{id}")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"order_id": 789,
"order_number": "789",
"order_parent": 0,
"order_date": "December 15, 2024, 2:20 pm",
"order_status": "Completed",
"order_currency": "USD",
"billing_address": "John Doe, 123 Main St, Apt 4B, Anytown, CA, 12345, US",
"shipping_address": "John Doe, 123 Main St, Apt 4B, Anytown, CA, 12345, US",
"phone": "+1234567890",
"email": "john@example.com",
"ship_to_billing": false,
"items": [
{
"item_id": 1,
"product_id": 456,
"variation_id": 0,
"product_image": "https://example.com/wp-content/uploads/product.jpg",
"product_name": "Premium T-Shirt",
"product_title": "Premium T-Shirt",
"product_type": "simple",
"sku": "TSHIRT-001",
"quantity": "2",
"subtotal": "$39.98",
"purchase_note": "",
"refunded_qty": "0",
"meta": {},
"link": "https://example.com/wp-json/cocart/preview/products/456"
}
],
"totals": {
"subtotal": {
"label": "Subtotal",
"value": "$39.98"
},
"shipping": {
"label": "Shipping",
"value": "$5.00"
},
"total": {
"label": "Total",
"value": "$44.98"
}
},
"order_note": "Please leave at the door",
"order_notes": [
{
"date": "December 15, 2024, 2:25 pm",
"note": "Your order has been shipped"
}
],
"downloads": [],
"order_actions": {
"view": {
"url": "https://example.com/wp-json/cocart/preview/my-account/orders/789",
"name": "View"
}
}
}{
"code": "<string>",
"message": "<string>",
"data": {
"status": 123
}
}{
"code": "<string>",
"message": "<string>",
"data": {
"status": 123
}
}My Account - Get Single Order
Retrieve detailed information about a specific customer order
GET
/
my-account
/
orders
/
{id}
Get specific order details
curl --request GET \
--url {protocol}://{host}/wp-json/cocart/preview/my-account/orders/{id}import requests
url = "{protocol}://{host}/wp-json/cocart/preview/my-account/orders/{id}"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('{protocol}://{host}/wp-json/cocart/preview/my-account/orders/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "{protocol}://{host}/wp-json/cocart/preview/my-account/orders/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{protocol}://{host}/wp-json/cocart/preview/my-account/orders/{id}"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("{protocol}://{host}/wp-json/cocart/preview/my-account/orders/{id}")
.asString();require 'uri'
require 'net/http'
url = URI("{protocol}://{host}/wp-json/cocart/preview/my-account/orders/{id}")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"order_id": 789,
"order_number": "789",
"order_parent": 0,
"order_date": "December 15, 2024, 2:20 pm",
"order_status": "Completed",
"order_currency": "USD",
"billing_address": "John Doe, 123 Main St, Apt 4B, Anytown, CA, 12345, US",
"shipping_address": "John Doe, 123 Main St, Apt 4B, Anytown, CA, 12345, US",
"phone": "+1234567890",
"email": "john@example.com",
"ship_to_billing": false,
"items": [
{
"item_id": 1,
"product_id": 456,
"variation_id": 0,
"product_image": "https://example.com/wp-content/uploads/product.jpg",
"product_name": "Premium T-Shirt",
"product_title": "Premium T-Shirt",
"product_type": "simple",
"sku": "TSHIRT-001",
"quantity": "2",
"subtotal": "$39.98",
"purchase_note": "",
"refunded_qty": "0",
"meta": {},
"link": "https://example.com/wp-json/cocart/preview/products/456"
}
],
"totals": {
"subtotal": {
"label": "Subtotal",
"value": "$39.98"
},
"shipping": {
"label": "Shipping",
"value": "$5.00"
},
"total": {
"label": "Total",
"value": "$44.98"
}
},
"order_note": "Please leave at the door",
"order_notes": [
{
"date": "December 15, 2024, 2:25 pm",
"note": "Your order has been shipped"
}
],
"downloads": [],
"order_actions": {
"view": {
"url": "https://example.com/wp-json/cocart/preview/my-account/orders/789",
"name": "View"
}
}
}{
"code": "<string>",
"message": "<string>",
"data": {
"status": 123
}
}{
"code": "<string>",
"message": "<string>",
"data": {
"status": 123
}
}This endpoint is currently shown as a preview of what’s currently in development and is subject to change.
As WooCommerce sends customers an email of the order review, you could use this endpoint to allow customers to return and view their full order without authorization so long as the order ID and order billing email address match. This is useful for guest checkouts.
If the endpoint is accessed with authentication, the order ID must belong to the authenticated user. The billing email address is not required in this case.
Response
Order details retrieved successfully