Enabling the API for old versions of WooCommerce
If you're using a version of WooCommerce released before July 15, 2015, there's a slightly different way to enable the API. This applies to WooCommerce versions 2.3.x and 2.2.x.
Step 1: Enable Permalinks
Permalinks are a feature in WordPress that lets you use pretty URLs instead of ones that just have numbers in them. For example, with permalinks enabled, your new blog post could be a http://www.example.com/blog/how-to-enable-api-access instead of http://www.example.com/?p=591. In order for the WooCommerce API to work, permalinks should be enabled, but it’s good practice to do this anyway as there are also SEO benefits.
To enable permalinks:
- Log in to WordPress
- Click on Settings
- Click on Permalinks:
4. To activate permalinks click on any of the options besides ‘Plain.’
5. Click on Save Changes at the bottom of the page:
6. Go back to your blog’s home page. When you click on links to your blog’s posts, you should see that they have nicer-looking URLs.
If it doesn’t seem like the URLs are working, you might need to change a server setting to get them to work. More information on that can be found in the WordPress documentation.
Step 2: Activate the API
The API can be activated on the main WooCommerce settings page.
- Go back to your WordPress site’s administration page
- Click on WooCommerce
- Click on Settings:
4. On the settings page, make sure the Enable the REST API checkbox is checked
5. Click on Save Changes at the bottom of the page.
Step 3: Get your API Credentials
In older versions of WooCommerce API, credentials are tied to a specific user.
- On the main menu on the left of the WordPress admin section, click on the Users tab:
2. Click on your username. You'll see a lot of settings you can change.
3. Scroll down to the bottom of the page and check Generate API Key:
4. Once the box is checked, reload the page.
5. Now, scroll down to the bottom of the page again. You should see your API credentials where the checkbox used to be:
The Consumer Key will always start with 'ck_,' and the consumer secret will always begin with 'cs_.'