Descrição
Enhances your store’s REST API by adding powerful, flexible endpoints.
Stay tuned more are coming!
Add or Remove a Single Category
Easily append or remove one category at a time—by numeric ID or human-friendly slug—using simple POST/PUT/PATCH or DELETE requests to
/wp-json/wc/v3/products/{product_id}/categories/{identifier}
Batch Manage Multiple Categories
In a single call, add or remove multiple categories at once via JSON payloads to
/wp-json/wc/v3/products/{product_id}/categories
Supply an array of IDs or slugs under the “categories” key to update your product’s category list in bulk.
Automatic Slug Resolution
Pass slugs like “summer-collection” and the plugin will resolve them to the correct WooCommerce term IDs on the fly—no extra lookups required.
Non-Destructive Updates
Neither endpoint touches other product data. Categories are merged or pruned transparently without overwriting prices, stock, attributes, or any other fields.
Built-In Validation & Security
Sanitization of all inputs (IDs and slugs) to guard against bad data.
Permission checks ensure only users with the edit_products capability (Shop Manager, Admin) can modify categories.
Clear, standardized error codes (w3s_api_extension_invalid_product and w3s_api_extension_invalid_product_category) for consistent API responses.
W3S API Extension for WooCommerce installs alongside the core WooCommerce REST API, requires no additional configuration, and works out of the box.
Endpoints Documentation
Product Categories
-
Add a single category
- Type: HTTP request
- Endpoint: `/wp-json/wc/v3/products/{product_id}/categories/{identifier}`
- Methods: POST, PUT, PATCH
- Examples:
curl -X PUT https://example.com/wp-json/wc/v3/products/125/categories/18 \
-u consumer_key:consumer_secret
curl -X PUT https://example.com/wp-json/wc/v3/products/125/categories/my-category \
-u consumer_key:consumer_secret
-
Remove a single category
- Type: HTTP request
- Endpoint: `/wp-json/wc/v3/products/{product_id}/categories/{identifier}`
- Methods: DELETE
- Examples:
curl -X DELETE https://example.com/wp-json/wc/v3/products/125/categories/18 \
-u consumer_key:consumer_secret
curl -X DELETE https://example.com/wp-json/wc/v3/products/125/categories/my-category \
-u consumer_key:consumer_secret
-
Batch add categories
- Type: HTTP request
- Endpoint: `/wp-json/wc/v3/products/{product_id}/categories`
- Methods: POST, PUT, PATCH
- Example:
curl -X PUT https://example.com/wp-json/wc/v3/products/125/categories \
-u consumer_key:consumer_secret \
-H “Content-Type: application/json” \
-d ‘{“categories”: [1,”my-category”,3,”my-category-1″]}’
-
Batch delete categories
- Type: HTTP request
- Endpoint: `/wp-json/wc/v3/products/{product_id}/categories`
- Methods: DELETE
- Example:
curl -X DELETE https://example.com/wp-json/wc/v3/products/125/categories \
-u consumer_key:consumer_secret \
-H “Content-Type: application/json” \
-d ‘{“categories”: [1,”my-category”,3,”my-category-1″]}’
Extra notes
- The single category endpoint doesn’t allow slug with characters anything other than latin & numbers [a-z0-9]
- Strings that include only numbers will be parsed as IDs and not as Slugs
Instalação
- Upload the
w3s-api-extension
folder to the/wp-content/plugins/
directory. - Activate the plugin through the ‘Plugins’ menu in WordPress.
- OPTIONAL: Rewrite rules are flushed automatically on plugin activation. If you want, you can also flush them manually.
Avaliações
There are no reviews for this plugin.
Contribuidores e desenvolvedores
“W3S API Extension for Woocommerce” é um software com código aberto. As seguintes pessoas contribuíram para este plugin.
ContribuidoresTraduzir “W3S API Extension for Woocommerce” para o seu idioma.
Interessado no desenvolvimento?
Navegue pelo código, dê uma olhada no repositório SVN ou assine o registro de desenvolvimento via RSS.
Registro de alterações
1.0.1
- Fixed: readme file modifications
1.0.0
- Initial release