Fix search order by customer billing phone or shipping phone

This commit is contained in:
Maikel David Pérez Gómez 2023-04-24 18:04:18 -04:00
parent 99fd4a1e09
commit 576d589b6b
1 changed files with 10 additions and 0 deletions

View File

@ -603,6 +603,16 @@ class WC_Order_Data_Store_CPT extends Abstract_WC_Order_Data_Store_CPT implement
WHERE order_item_name LIKE %s",
'%' . $wpdb->esc_like( wc_clean( $term ) ) . '%'
)
),
$wpdb->get_col(
$wpdb->prepare(
"SELECT DISTINCT os.order_id FROM {$wpdb->prefix}wc_order_stats os
INNER JOIN {$wpdb->prefix}wc_customer_lookup cl ON os.customer_id = cl.customer_id
INNER JOIN {$wpdb->usermeta} um ON cl.user_id = um.user_id
WHERE (um.meta_key = 'billing_phone' OR um.meta_key = 'shipping_phone')
AND um.meta_value = %s",
wc_clean( $term )
)
)
)
);