Merge pull request #4184 from maxrice/api-order-status-update-issue-4161

Implement order status update endpoint
This commit is contained in:
Coen Jacobs 2013-11-24 12:58:15 -08:00
commit e9691eed7f
2 changed files with 10 additions and 3 deletions

View File

@ -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 );
}

View File

@ -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 );