-
Notifications
You must be signed in to change notification settings - Fork 10.7k
Order is search with the phone number and linked with the user accoun… #37844
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
mdperez86
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for addressing this @alishanvr!. I left one comment for your.
After testing this PR I had some problems with the resulting orders since there is no relation between the wp_wc_order_stats and the wp_usermeta tables.
cc: @louwie17
plugins/woocommerce/includes/data-stores/class-wc-order-data-store-cpt.php
Outdated
Show resolved
Hide resolved
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## trunk #37844 +/- ##
==========================================
- Coverage 51.5% 51.3% -0.2%
- Complexity 17283 17409 +126
==========================================
Files 430 440 +10
Lines 80037 80587 +550
==========================================
+ Hits 41216 41304 +88
- Misses 38821 39283 +462
|
|
@alishanvr Thanks for addressing my comment. That query was just an example, maybe not the best in term of performant. Also could you take a took at those failing checks please. They are required to move forward. https://github.com/woocommerce/woocommerce/actions/runs/4747662471/jobs/8434513966?pr=37844 |
|
Hey @alishanvr to keep things going please pay attention only to the 2 required checks. I'll let you know about the non required one once I have an answer from the expert team. |
|
Ok, @mdperez86! I am a little busy today. But, I will fix those two by later tomorrow. Kind Regards, |
|
Hi @mdperez86! I fixed the PHPCS and also touched the changelog. It's my first time to contributing to WooCommerce. So, please let me know if I did something wrong. Thank You, |
|
Hi @alishanvr thank for your contribution here. Also the changelog file you added here should be moved under You can move the changelog file manually or by running the following command Your help is always appreciated! |
|
Hi @mdperez86, Thank you for updating. I am not sure why there is an error in PHPCS, while the %i is also available in WordPress 6.2. And here is the screenshot as a reference: If we still need to update (change) the %i, then please let me know and I will check it. |
|
Hi @alishanvr I was able to run the PHPCS without any problems after changing the query to $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 )
)The error you seen could happened due to the string concatenation like |
…file to the correct path
|
Thank you for updating. I just updated both points. |
|
Thanks @alishanvr |
|
Ok, I removed the %i and now used the older way. Thank You, |
|
Thank you so much for your contribution @alishanvr. This PR looks good to me! |
mdperez86
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!!! Nice job @alishanvr
#37844) * Order is search with the phone number and linked with the user account. #36810 * updated the query and tested on local env * fixed the phpcs issue * added the changelog * updated the string concatenation issue and also moved the change log file to the correct path * removed the %i placeholder from the query and used the old way to add the table name
|
Steps to test:
|

[Enhancement]: Allow searching by users/customers phone #36810
Submission Review Guidelines:
Closes #36810 .