REST API
WOOCS provides REST API functionality for retrieving currency data and product prices programmatically.
Available Endpoints:
1. Get All Currencies
- Method: GET
- Endpoint:
/wp-json/woocs/v3/currency - Description: Returns a list of all available currencies with their settings and exchange rates.
2. Get Single Product Price
- Method: GET
- Endpoint:
/wp-json/woocs/v3/product-price/{product_id}?currency={currency_code} - Example:
/wp-json/woocs/v3/product-price/59?currency=GBP&format=raw - Description: Retrieves the price of a specific product in the requested currency.
- Parameters:
product_id(required) – WooCommerce product IDcurrency(optional) – Currency code (e.g., GBP, EUR, USD)format(optional) – Response format:htmlorraw(default:html)
3. Get Multiple Products Prices
- Method: POST
- Endpoint:
/wp-json/woocs/v3/products-prices - Content-Type:
application/json - Description: Retrieves prices for multiple products in a specified currency.
- Request Body:
{ "product_ids": [59, 62, 50], "currency": "GBP", "format": "html" }
- Parameters:
product_ids(required) – Array of product IDscurrency(optional) – Currency codeformat(optional) – Response format:htmlorraw
Example using cURL:
curl -X POST https://your-site.com/wp-json/woocs/v3/products-prices \
-H "Content-Type: application/json" \
-d '{
"product_ids": [59, 62, 50],
"currency": "GBP"
}'
