Install
This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.
Install straight from GitHub with WP-CLI:
wp plugin install https://github.com/coderjahidul/wc-product-api/archive/refs/heads/main.zipNo built-in updater. New versions won't appear under Dashboard → Updates. Install new releases yourself, or let Git Updater track the repository.
A professional, context-rich REST API for WooCommerce that provides detailed product information including variants, categories, and custom attributes with built-in pagination and security.
Features
- Enriched Data: Returns detailed product info (Title, Description, Categories, Tags, Images).
- Variation Support: Detailed breakdown for variable products.
- Security: Optional API Key authentication via
X-WC-API-KEYheader. - Pagination: Optimized for large catalogs (50 products per page).
- Easy Setup: User-friendly settings page with generated cURL examples.
- OOP Architecture: Built with a clean, object-oriented structure.
Installation
- Upload the
wc-product-apifolder to your/wp-content/plugins/directory. - Activate the plugin through the 'Plugins' menu in WordPress.
- Ensure WooCommerce is installed and active.
Configuration
Navigate to WC Product API in your WordPress sidebar to:
- Enable or Disable the API.
- Set a custom API Key for secure access.
- Configure external API credentials (URL, Username, Password) if needed.
- Copy your unique API endpoint and cURL examples.
API Documentation
Endpoint
GET /wp-json/wc-product-api/v1/products
Query Parameters
page(optional): The page number of results (e.g.,?page=2). Defaults to1.
Authentication
Include the following header if an API Key is configured:
X-WC-API-KEY: your_api_key_here
cURL Example
curl -X GET https://your-site.com/wp-json/wc-product-api/v1/products \
-H "X-WC-API-KEY: your_api_key_here"
Response Schema
{
"products": [
{
"id": 123,
"title": "Premium T-Shirt",
"slug": "premium-t-shirt",
"sku": "TS-001",
"description": "...",
"price": "25.00",
"categories": ["Apparel", "T-Shirts"],
"images": ["https://.../img1.jpg"],
"variants": [
{
"id": 124,
"sku": "TS-001-RED",
"price": "25.00",
"attributes": { "pa_color": "red" }
}
]
}
],
"pagination": {
"total": 100,
"pages": 2,
"current_page": 1,
"per_page": 50
}
}
Credits
Author: Grocoder Software Solutions
Website: https://facebook.com/grocoder