Add paginate

This commit is contained in:
claudiulodro 2017-04-27 15:02:02 -07:00
parent 11c7722eff
commit 0721354ff2
2 changed files with 2 additions and 1 deletions

View File

@ -229,6 +229,7 @@ class WC_Data_Store_WP {
'limit' => 'posts_per_page', 'limit' => 'posts_per_page',
'type' => 'post_type', 'type' => 'post_type',
'return' => 'fields', 'return' => 'fields',
'paginate' => 'no_found_rows',
); );
if ( isset( $key_mapping[ $key ] ) ) { if ( isset( $key_mapping[ $key ] ) ) {

View File

@ -738,10 +738,10 @@ class WC_Order_Data_Store_CPT extends Abstract_WC_Order_Data_Store_CPT implement
public function query( $query_vars ) { public function query( $query_vars ) {
$args = $this->get_wp_query_args( $query_vars ); $args = $this->get_wp_query_args( $query_vars );
$query = new WP_Query( $args ); $query = new WP_Query( $args );
if ( isset( $query_vars['return'] ) && 'ids' === $query_vars['return'] ) { if ( isset( $query_vars['return'] ) && 'ids' === $query_vars['return'] ) {
return $query->posts; return $query->posts;
} }
// paged?
return array_map( 'wc_get_order', $query->posts ); return array_map( 'wc_get_order', $query->posts );
} }
} }