|
2 | 2 | /** |
3 | 3 | * WooCommerce order data store. |
4 | 4 | * |
5 | | - * Orders are still treated as posts within WordPress, but the data is stored in a separate table. |
6 | | - * |
7 | 5 | * @package WooCommerce_Custom_Order_Tables |
8 | 6 | * @author Liquid Web |
9 | 7 | */ |
10 | 8 |
|
| 9 | +/** |
| 10 | + * Extension of the Abstract_WC_Order_Data_Store_CPT class, designed to map data between |
| 11 | + * WooCommerce and the custom database table. |
| 12 | + * |
| 13 | + * Orders are still treated as posts within WordPress, but the data is stored in a separate table. |
| 14 | + */ |
11 | 15 | class WC_Order_Data_Store_Custom_Table extends Abstract_WC_Order_Data_Store_CPT implements WC_Object_Data_Store_Interface, WC_Order_Data_Store_Interface { |
12 | 16 |
|
13 | 17 | /** |
@@ -403,12 +407,12 @@ public function get_orders( $args = array() ) { |
403 | 407 | $wc_customer_query = array(); |
404 | 408 |
|
405 | 409 | if ( ! empty( $args['customer'] ) ) { |
406 | | - $values = is_array( $args['customer'] ) ? $args['customer'] : array( $args['customer'] ); |
| 410 | + $values = is_array( $args['customer'] ) ? $args['customer'] : array( $args['customer'] ); |
407 | 411 | $wc_customer_query = array_merge( $wc_customer_query, $values ); |
408 | 412 | } |
409 | 413 |
|
410 | 414 | if ( ! empty( $args['email'] ) ) { |
411 | | - $values = is_array( $args['email'] ) ? $args['email'] : array( $args['email'] ); |
| 415 | + $values = is_array( $args['email'] ) ? $args['email'] : array( $args['email'] ); |
412 | 416 | $wc_customer_query = array_merge( $wc_customer_query, $values ); |
413 | 417 | } |
414 | 418 |
|
@@ -482,13 +486,13 @@ public function get_orders( $args = array() ) { |
482 | 486 | */ |
483 | 487 | private function get_orders_generate_customer_meta_query( $values, $relation = 'or' ) { |
484 | 488 | $meta_query = array( |
485 | | - 'relation' => strtoupper( $relation ), |
| 489 | + 'relation' => strtoupper( $relation ), |
486 | 490 | 'customer_emails' => array( |
487 | 491 | 'key' => '_billing_email', |
488 | 492 | 'value' => array(), |
489 | 493 | 'compare' => 'IN', |
490 | 494 | ), |
491 | | - 'customer_ids' => array( |
| 495 | + 'customer_ids' => array( |
492 | 496 | 'key' => '_customer_user', |
493 | 497 | 'value' => array(), |
494 | 498 | 'compare' => 'IN', |
@@ -713,7 +717,7 @@ public function populate_from_meta( &$order, $save = true, $delete = false ) { |
713 | 717 |
|
714 | 718 | if ( is_null( $table_data ) ) { |
715 | 719 | $original_creating = $this->creating; |
716 | | - $this->creating = true; |
| 720 | + $this->creating = true; |
717 | 721 | } |
718 | 722 |
|
719 | 723 | foreach ( $this->get_postmeta_mapping() as $column => $meta_key ) { |
@@ -777,8 +781,8 @@ public function query( $query_vars ) { |
777 | 781 |
|
778 | 782 | if ( ! empty( $args['errors'] ) ) { |
779 | 783 | $query = (object) array( |
780 | | - 'posts' => array(), |
781 | | - 'found_posts' => 0, |
| 784 | + 'posts' => array(), |
| 785 | + 'found_posts' => 0, |
782 | 786 | 'max_num_pages' => 0, |
783 | 787 | ); |
784 | 788 | } else { |
|
0 commit comments