Get customer orders
curl --request GET \
--url {protocol}://{host}/wp-json/cocart/preview/my-account/orders \
--header 'Authorization: Basic <encoded-value>'import requests
url = "{protocol}://{host}/wp-json/cocart/preview/my-account/orders"
headers = {"Authorization": "Basic <encoded-value>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Basic <encoded-value>'}};
fetch('{protocol}://{host}/wp-json/cocart/preview/my-account/orders', 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",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>"
],
]);
$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"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Basic <encoded-value>")
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")
.header("Authorization", "Basic <encoded-value>")
.asString();require 'uri'
require 'net/http'
url = URI("{protocol}://{host}/wp-json/cocart/preview/my-account/orders")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Basic <encoded-value>'
response = http.request(request)
puts response.read_body{
"orders": [
{
"order_id": 789,
"order_status": "Completed",
"order_date": "December 15, 2024, 2:20 pm",
"item_count": 3,
"order_total": "$89.97",
"order_actions": {
"view": {
"url": "https://example.com/wp-json/cocart/preview/my-account/orders/789",
"label": "View"
}
}
},
{
"order_id": 788,
"order_status": "Processing",
"order_date": "December 10, 2024, 10:15 am",
"item_count": 1,
"order_total": "$29.99",
"order_actions": {
"view": {
"url": "https://example.com/wp-json/cocart/preview/my-account/orders/788",
"label": "View"
}
}
}
],
"pagination": {
"previous": null,
"next": "https://example.com/wp-json/cocart/preview/my-account/orders?page=2"
}
}{
"code": "<string>",
"message": "<string>",
"data": {
"status": 123
}
}My Account - Get Orders
Retrieve customer order history with pagination
GET
/
my-account
/
orders
Get customer orders
curl --request GET \
--url {protocol}://{host}/wp-json/cocart/preview/my-account/orders \
--header 'Authorization: Basic <encoded-value>'import requests
url = "{protocol}://{host}/wp-json/cocart/preview/my-account/orders"
headers = {"Authorization": "Basic <encoded-value>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Basic <encoded-value>'}};
fetch('{protocol}://{host}/wp-json/cocart/preview/my-account/orders', 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",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>"
],
]);
$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"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Basic <encoded-value>")
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")
.header("Authorization", "Basic <encoded-value>")
.asString();require 'uri'
require 'net/http'
url = URI("{protocol}://{host}/wp-json/cocart/preview/my-account/orders")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Basic <encoded-value>'
response = http.request(request)
puts response.read_body{
"orders": [
{
"order_id": 789,
"order_status": "Completed",
"order_date": "December 15, 2024, 2:20 pm",
"item_count": 3,
"order_total": "$89.97",
"order_actions": {
"view": {
"url": "https://example.com/wp-json/cocart/preview/my-account/orders/789",
"label": "View"
}
}
},
{
"order_id": 788,
"order_status": "Processing",
"order_date": "December 10, 2024, 10:15 am",
"item_count": 1,
"order_total": "$29.99",
"order_actions": {
"view": {
"url": "https://example.com/wp-json/cocart/preview/my-account/orders/788",
"label": "View"
}
}
}
],
"pagination": {
"previous": null,
"next": "https://example.com/wp-json/cocart/preview/my-account/orders?page=2"
}
}{
"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.
Authorizations
basicAuthbearerAuth
WordPress username and password
Query Parameters
The pagination of orders to return
Required range:
1 <= x <= 100Limit amount of orders to return per page
Required range:
1 <= x <= 50Order sort attribute ascending or descending
Available options:
ASC, DESC ⌘I