Develop WooCommerce

The official WooCommerce development blog

New REST API based on the WP REST API in 2.6 — April 22, 2016

New REST API based on the WP REST API in 2.6

During the development of WooCommerce 2.1 (Back in Feb 2014) we knew that one day WordPress would have it’s own REST API, but the demand was so great for such a thing in WooCommerce we had to roll our own.

We’ve learned a lot from this process and our API is now widely used, but given recent developments surrounding the actual WordPress REST API, and since it is now part of WordPress core (since version 4.4) we started work to replace ours with what is available in WordPress.

2.6 will contain this new API, and will require WordPress 4.4 or higher.

Continue reading

API Settings and the API Authentication Endpoint in 2.4 — August 7, 2015

API Settings and the API Authentication Endpoint in 2.4

API Settings

In WooCommerce 2.4 we now have a tab in the settings dedicated to our Rest API. Previously these options were scattered around in the general and webhooks tab and user pages. These are now grouped.


In addition, API keys are no longer found within each user profile. Everything is grouped and a user can have multiple API keys. Previously a user could only have 1 key.


In 2.4 it’s easy to organise your keys and know what each key was generated for and when it was last used.

We also did some security updates to generate hashes from the new keys. Keys can only be viewed at the time they are generated:


API Authentication Endpoint

Our authentication endpoint allows easy integration between WooCommerce and Apps, since the API keys are created with just one click from the store manager.


This facilitates the integration, especially for Apps on mobile devices.

To generate a URL for our authentication endpoint is quite simple.

You must use our new /wc-auth/v1/authorize endpoint and pass the following parameters as query string:

  • app_name – Your app name
  • scope – Level of access. Available: read, write and read_write
  • user_id – User ID in your app (for your internal reference)
  • return_url – URL that will be used for receive the user back
  • callback_url – URL that will receive the generated API key. Important to note that this URL should be over SSL

Here an example in PHP and soon it will also be available in our REST API docs:

New WooCommerce REST API wrappers — August 6, 2015
2.2 Prowling Pangolin Beta 1: Release and highlights — August 1, 2014

2.2 Prowling Pangolin Beta 1: Release and highlights

This week we’re happy to announce WC 2.2 “Prowling Pangolin” beta 1 is available for testing.

             ,___,           ╭────────────╮
      ╭╴╴╴╴/ ⏖ ⏖ ╴╴╴╮    ┃  Woo! 2.2  ┃
   ╭╯⏖ ⏖ ⏖ ⏖ ⏖ ⏖ ( ⦿    ╰─y──────────╯
 ↜╯╯    ‴▾▾LL▾▾▾▾▾LL   \   

Since 2.1 we’ve had a whopping 1401 commits. You can view the changelog here and see what we’ve been busy working on:

Before going into the features, developers should be aware of the following changes:

  1. Order statuses are no longer taxonomy based – the post status is used. This makes order queries lighter, but custom order queries may need to be updated.
  2. Orders can now be retrieved using the get_order() wc_get_order() function.
  3. Orders can be created using the new wc_create_order() function.
  4. Gateways can now handle refunds by declaring support for the ‘refunds’ feature, and including a process_refund() method (see PayPal Standard in WC core for an example).
  5. Gateways can pass the payment_complete() method a transaction ID to have it stored in a standardized format.
  6. v2 of the API which includes PUT/POST/DELETE methods is included. v1 of the API is still present until v3 is eventually released.

Aside from the countless fixes and tweaks, here are a few of the key features in 2.2.

Rest API v2

Version 2 of the API introduces PUT/POST/DELETE support for Coupons, Orders, Products and customers and will really widen the possibilities of integrating with WooCommerce from external apps. Full documentation for v2 of the API should be ready soon, but it’s there if you want to play.

Massive props to SkyVerge (Max and Justin in particular) for their contributions to the API.


Refunds has been a feature we’ve wanted to tackle for a long time, but has been put back due to it’s scope a few times. We’re proud to finally have this feature built.

Refunds consists of two parts;

  1. An API for Payment Gateways to handle refunds directly though code.
  2. An interface to handle refunds from the orders UI.

The greatest challenges with refunds were;

  1. Keeping reports accurate after partial refunds.
  2. Having a simple interface to handle the refund process…
  3. …which led us to redesign the order item and order totals panels and combine them.
  4. Modifying our data structures (particulary for line items) to support the above.

Here is an example of the new UI for order totals and items:

2014-08-01 at 10.05

You’ll notice shipping, taxes, fees are all displayed in the same area which should improve usability.

This is what the UI looks like when doing a refund:

2014-08-01 at 10.06

Unfortunetely, due to the structure of data in 2.1 and below (particulary the way in which taxes were stored, never at line level) we’ve had to sacrifice the tax columns and partial refund functionality for legacy orders – but going forward, all new orders will benefit from the new functionality.

We’re keen to hear your feedback about refunds in 2.2!

Improved language file handling

One thing we started noticing with recent releases was that the filesize for WooCommerce was huge. 2.1.12 was over 8mb. This can make updating difficult for example if there are upload limits.

The reason for the size; localisation files. Uncompressed we’re talking 32mb of PO and MO files in core.

To resolve this, 2.2 includes a language pack downloader. PO and MO files will no longer be bundled with the plugin – they will be downloadable from your dashboard if you have the WPLANG constant set, or from a git repository if you wish to grab them manually.

Give us your feedback and get involved

We’re happy to hear your feedback about 2.2 and would appriciate any bug reports going directly to Github.

Download 2.2 Beta 1

If you find a bug with the beta, please ensure you prepend the ticket title with [2.2] when submitting the issue to GitHub, or at least mention what version you are using in the ticket description.

Also when reporting anything to us:

  1. Describe the issue in detail, with a system status report
  2. Don’t report issues with extensions, only core
  3. Don’t report issues with themes
  4. Report bugs, not feature requests


The REST API has landed in the master branch! — November 19, 2013

The REST API has landed in the master branch!

The REST API has landed in the master branch! Max Rice has been going above and beyond in the past month to get the REST API implementation ready for merge into WooCommerce core. This morning, I had the awesome job to merge it to the master branch and start testing it extensively.

This was the last big issue left on our tracker before we could release the first beta of WooCommerce 2.1. You can imagine that I’m really happy that Max pulled this off, well ahead of our beta 1 schedule. There are a couple things to discuss (soon to be posted as issues on our tracker in GitHub) for the API still, but these are not required for the WooCommerce 2.1 release. We can add them as soon as they are done, or they will be released in with WooCommerce 2.2.

For now, we can all start testing the API so obvious issues can be fixed before we release the first beta. You can find a list of all available API endpoints in the original pull request on GitHub. We still need to finish the documentation before release 1 date, but for now this is all we can offer for initial testing of the REST API.