Prerequisites
- WooCommerce API Keys: You need Consumer Key and Consumer Secret.
- Base URL: Replace
https://yourstore.comwith your actual WooCommerce store URL. - Authorization: Basic Auth with your Consumer Key and Consumer Secret.
Authorization Setup in Postman
- Go to the Authorization tab.
- Select Type: Basic Auth.
- Username: Enter your Consumer Key.
- Password: Enter your Consumer Secret.
1. List Tax Classes
- URL:
https://yourstore.com/wp-json/wc/v3/tax/classes - Method: GET
- Headers:
Authorization: Basic Auth
Example in Postman:
- Set method to GET.
- Enter URL:
https://yourstore.com/wp-json/wc/v3/tax/classes - Go to the Authorization tab and set Type to Basic Auth.
- Enter Consumer Key and Consumer Secret.
- Send the request.
2. Retrieve a Tax Class
- URL:
https://yourstore.com/wp-json/wc/v3/tax/classes/{slug} - Method: GET
- Headers:
Authorization: Basic Auth
- Replace
{slug}with the actual tax class slug.
Example in Postman:
- Set method to GET.
- Enter URL:
https://yourstore.com/wp-json/wc/v3/tax/classes/{slug} - Go to the Authorization tab and set Type to Basic Auth.
- Enter Consumer Key and Consumer Secret.
- Send the request.
3. Create a Tax Class
- URL:
https://yourstore.com/wp-json/wc/v3/tax/classes - Method: POST
- Headers:
Authorization: Basic Auth
- Body: JSON with tax class data.
Example JSON Body:
{
"slug": "standard",
"name": "Standard Tax",
"description": "Standard tax class"
}
Example in Postman:
- Set method to POST.
- Enter URL:
https://yourstore.com/wp-json/wc/v3/tax/classes - Go to the Authorization tab and set Type to Basic Auth.
- Enter Consumer Key and Consumer Secret.
- Go to the Body tab, select
raw, chooseJSONfrom the dropdown, and paste the example JSON body. - Send the request.
4. Update a Tax Class
- URL:
https://yourstore.com/wp-json/wc/v3/tax/classes/{slug} - Method: PUT
- Headers:
Authorization: Basic Auth
- Body: JSON with updated tax class data.
- Replace
{slug}with the actual tax class slug.
Example JSON Body:
{
"name": "Updated Standard Tax",
"description": "Updated description for Standard Tax"
}
Example in Postman:
- Set method to PUT.
- Enter URL:
https://yourstore.com/wp-json/wc/v3/tax/classes/{slug} - Go to the Authorization tab and set Type to Basic Auth.
- Enter Consumer Key and Consumer Secret.
- Go to the Body tab, select
raw, chooseJSONfrom the dropdown, and paste the example JSON body. - Send the request.
5. Delete a Tax Class
- URL:
https://yourstore.com/wp-json/wc/v3/tax/classes/{slug} - Method: DELETE
- Headers:
Authorization: Basic Auth
- Replace
{slug}with the actual tax class slug.
Example in Postman:
- Set method to DELETE.
- Enter URL:
https://yourstore.com/wp-json/wc/v3/tax/classes/{slug} - Go to the Authorization tab and set Type to Basic Auth.
- Enter Consumer Key and Consumer Secret.
- Send the request.
By following these instructions, you can test each WooCommerce tax classes endpoint in Postman. Each request should include the necessary Authorization header configured through Basic Auth with your Consumer Key and Consumer Secret. Adjust the {slug} parameter with the actual tax class slug you intend to work with for retrieving, updating, or deleting operations.