Skip to content

Instantly share code, notes, and snippets.

@thenbrent
Last active December 22, 2015 18:39
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thenbrent/6514417 to your computer and use it in GitHub Desktop.
Save thenbrent/6514417 to your computer and use it in GitHub Desktop.
WooCommerce Developer Test

WooCommerce API Test

Create a WordPress plugin to add an API endpoint for recent orders placed with a WooCommerce store.

The API endpoint should accept one parameter - an integer for the number of recent orders. For example, passing "5" to the endpoint will return the 5 most recent orders (ordered from newest to oldest).

If no integer is passed to the endpoint, WordPress's default posts per page setting should be used to determine the number of orders.

The endpoint's response should be a JSON object containing the relevant number of WC_Order objects.

Tips:

  1. There is a WooComerce way & pure PHP way to create an API, the WooCommerce way is the correct way for this test.
  2. Orders in WooCommerce are a custom post type.

Non-functional requirements:

  • share you answer via a GitHub repo (public or private).
  • your code must conform to the WordPress Coding Standards.
  • using an object-oriented structure for your plugin will earn you bonus points.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment