WC 2.2 order statuses: plugin compatibility

Develop WooCommerce

Orders can have several statuses in WooCommerce; completed, processing, on-hold, pending to name a few.

In WooCommerce 2.1, statuses were associated with orders via a taxonomy called shop_order_status. The shop_order_status taxonomy is no more in 2.2.

Instead, 2.2 uses post_status for the order status. In terms of usage, this makes more sense – regular post statuses are of little use for orders (since when did you have a non-published order?). For performance, using post status has several benefits, particulary to queries and reporting which can now contain less table joins.

How does this affect developers? If you query shop_order posts via a get_posts() function, or DB query, you will need to modify your code to fully support 2.2. Otherwise you’ll either get a notice, or no results.

If you are calling get_posts() for the shop_order post type

Here is an example of a 2.1 order query:

$orders = get_posts( array(…

View original post 240 more words


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s