Skip to main content
GET
/
products
/
attributes
/
{attribute_id}
/
terms
/
{id}
Get single product attribute term
curl --request GET \
  --url {protocol}://{host}/wp-json/cocart/v2/products/attributes/{attribute_id}/terms/{id}
import requests

url = "{protocol}://{host}/wp-json/cocart/v2/products/attributes/{attribute_id}/terms/{id}"

response = requests.get(url)

print(response.text)
const options = {method: 'GET'};

fetch('{protocol}://{host}/wp-json/cocart/v2/products/attributes/{attribute_id}/terms/{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/v2/products/attributes/{attribute_id}/terms/{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/v2/products/attributes/{attribute_id}/terms/{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/v2/products/attributes/{attribute_id}/terms/{id}")
.asString();
require 'uri'
require 'net/http'

url = URI("{protocol}://{host}/wp-json/cocart/v2/products/attributes/{attribute_id}/terms/{id}")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body
{
  "id": 123,
  "name": "<string>",
  "slug": "<string>",
  "description": "<string>",
  "menu_order": 123,
  "count": 123
}
{
"code": "cocart_invalid_id",
"message": "Invalid attribute or term ID provided.",
"data": {
"status": 400
}
}
{
"code": "cocart_term_not_found",
"message": "Product attribute term not found.",
"data": {
"status": 404
}
}

Path Parameters

attribute_id
integer
required

Unique identifier for the attribute.

id
integer
required

Unique identifier for the attribute term.

Response

Product attribute term retrieved successfully.

id
integer

Unique identifier for the resource.

name
string

Term name.

slug
string

An alphanumeric identifier for the resource unique to its type.

description
string

HTML description of the resource.

menu_order
integer

Menu order, used to custom sort the resource.

count
integer

Number of published products for the resource.