Update API functions

This commit is contained in:
Mike Jolley 2014-05-30 16:34:59 +01:00
parent 05b9b8af4e
commit ae50495dfd
2 changed files with 7 additions and 14 deletions

View File

@ -194,7 +194,7 @@ class WC_API_Customers extends WC_API_Resource {
WHERE meta.meta_key = '_customer_user'
AND meta.meta_value = {$customer->ID}
AND posts.post_type = 'shop_order'
AND posts.post_status = 'publish'
AND posts.post_status IN ( '" . implode( "','", array_keys( wc_get_order_statuses() ) ) . "' )
" );
$customer_data = array(
@ -444,7 +444,7 @@ class WC_API_Customers extends WC_API_Resource {
WHERE meta.meta_key = '_customer_user'
AND meta.meta_value = '%s'
AND posts.post_type = 'shop_order'
AND posts.post_status = 'publish'
AND posts.post_status IN ( '" . implode( "','", array_keys( wc_get_order_statuses() ) ) . "' )
", $id ) );
if ( empty( $order_ids ) ) {

View File

@ -355,24 +355,17 @@ class WC_API_Orders extends WC_API_Resource {
// set base query arguments
$query_args = array(
'fields' => 'ids',
'post_type' => 'shop_order',
'post_status' => 'publish',
'post_type' => 'shop_order'
);
// add status argument
if ( ! empty( $args['status'] ) ) {
$statuses = explode( ',', $args['status'] );
$query_args['tax_query'] = array(
array(
'taxonomy' => 'shop_order_status',
'field' => 'slug',
'terms' => $statuses,
),
);
$statuses = explode( ',', $args['status'] );
$query_args['post_status'] = $statuses;
unset( $args['status'] );
} else {
$query_args['post_status'] = array_keys( wc_get_order_statuses() );
}
$query_args = $this->merge_query_args( $query_args, $args );