Update Product Category

PATCH /wp-json/content-api/v1/product-category/

Updates a specific product category by ID.

Content API Version: 1.0.3

Authentication

This endpoint requires a Bearer token in the Authorization header. To authenticate:

  1. Go to Content API > Settings in your WordPress admin panel.
  2. Set a secure token in the “Token” field and save it.
  3. Include the token in your request header as follows:
Authorization: Bearer 

Replace with the token you configured.

Parameters

Name Type Description Required
id integer The ID of the product category to update Yes
taxonomy string Taxonomy name (defaults to product_cat) No
name string The updated name of the product category No
description string The updated description of the product category No
slug string The updated slug of the product category No
parent integer The ID of the parent product category (set to 0 to remove parent) No
yoast object Yoast SEO meta fields (title, description, premium social data) No

Example Request

PATCH /wp-json/content-api/v1/product-category/
Content-Type: application/json

{
  "id": 1,
  "taxonomy": "product_cat",
  "name": "Updated Sunglasses",
  "description": "Updated description for Sunglasses",
  "slug": "updated-sunglasses",
  "parent": 0,
  "yoast": {
    "title": "Updated Sunglasses Title",
    "description": "Updated Sunglasses Description",
    "premium": {
      "social_appearance": {
        "title": "Updated Social Title",
        "description": "Updated Social Description",
        "image": "https://example.com/wp-content/uploads/updated-sunglasses.jpg"
      },
      "x": {
        "title": "Updated X Title",
        "description": "Updated X Description",
        "image": "https://example.com/wp-content/uploads/updated-sunglasses-x.jpg"
      }
    }
  }
}

Example Response

{
  "success": true,
  "product_category_id": 1,
  "message": "Product category updated successfully."
}

Possible Errors

Code Message Description HTTP Status
missing_identifier Product category ID is required No product category ID was provided in the request. 400
product_category_not_found Product category not found No product category was found matching the provided ID. 404
invalid_parent The specified parent product category does not exist. The provided parent ID does not correspond to an existing product category . 400
term_update_failed Failed to update product category term An error occurred while updating the product category term. 500
not_authorized Not Authorized The provided Bearer token is invalid or does not match the configured token. 401