From deac0be31b0cd343b5e3d52b6158f7d32df11fc9 Mon Sep 17 00:00:00 2001 From: Max Rice Date: Sat, 23 Nov 2013 12:59:21 -0500 Subject: [PATCH] Implement order status update endpoint Closes #4161 --- includes/api/class-wc-api-orders.php | 9 ++++++++- includes/wc-formatting-functions.php | 4 ++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/includes/api/class-wc-api-orders.php b/includes/api/class-wc-api-orders.php index 20f6e191611..a6f9626b220 100644 --- a/includes/api/class-wc-api-orders.php +++ b/includes/api/class-wc-api-orders.php @@ -259,6 +259,8 @@ class WC_API_Orders extends WC_API_Resource { /** * Edit an order * + * API v1 only allows updating the status of an order + * * @since 2.1 * @param int $id the order ID * @param array $data @@ -271,7 +273,12 @@ class WC_API_Orders extends WC_API_Resource { if ( is_wp_error( $id ) ) return $id; - // TODO: implement, especially for status change + $order = new WC_Order( $id ); + + if ( ! empty( $data['status'] ) ) { + + $order->update_status( $data['status'], isset( $data['note'] ) ? $data['note'] : '' ); + } return $this->get_order( $id ); } diff --git a/includes/wc-formatting-functions.php b/includes/wc-formatting-functions.php index d5c21981854..f2975aafce3 100644 --- a/includes/wc-formatting-functions.php +++ b/includes/wc-formatting-functions.php @@ -19,7 +19,7 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly * * @access public * @param mixed $taxonomy - * @return void + * @return string */ function woocommerce_sanitize_taxonomy_name( $taxonomy ) { $filtered = strtolower( remove_accents( stripslashes( strip_tags( $taxonomy ) ) ) ); @@ -316,7 +316,7 @@ function woocommerce_price( $price, $args = array() ) { $num_decimals = absint( get_option( 'woocommerce_price_num_decimals' ) ); $currency_pos = get_option( 'woocommerce_currency_pos' ); $currency = isset( $args['currency'] ) ? $args['currency'] : ''; - $currency_symbol = get_woocommerce_currency_symbol($currency); + $currency_symbol = get_woocommerce_currency_symbol($currency); $decimal_sep = wp_specialchars_decode( stripslashes( get_option( 'woocommerce_price_decimal_sep' ) ), ENT_QUOTES ); $thousands_sep = wp_specialchars_decode( stripslashes( get_option( 'woocommerce_price_thousand_sep' ) ), ENT_QUOTES );