-
Notifications
You must be signed in to change notification settings - Fork 136
[POS Orders] Filter draft orders out #14893
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
base: trunk
Are you sure you want to change the base?
Conversation
📲 You can test the changes from this Pull Request in WooCommerce-Wear Android by scanning the QR code below to install the corresponding build.
|
|
📲 You can test the changes from this Pull Request in WooCommerce Android by scanning the QR code below to install the corresponding build.
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## trunk #14893 +/- ##
=========================================
Coverage 38.27% 38.27%
- Complexity 10101 10102 +1
=========================================
Files 2137 2137
Lines 120998 120998
Branches 16579 16579
=========================================
+ Hits 46309 46310 +1
Misses 69980 69980
+ Partials 4709 4708 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| orderBy = OrderBy.DATE, | ||
| sortOrder = OrderRestClient.SortOrder.DESCENDING, | ||
| statusFilter = null, | ||
| statusFilter = "pending,processing,on-hold,completed,cancelled,refunded,failed", |
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.
Keep in mind that this approach won’t work if there are any custom statuses or if a new status is introduced. Because of that reason, Povilas decided not to filter out this way the checkout-draft status.
Also, can it be that auto-draft not returned by default in the new versions of Woo? I don't see them. I checked the source code with Ai and it says:
Copilot said: Auto-draft orders are excluded because WooCommerce registers
Auto-draft orders are excluded because WooCommerce registers that post‑status as non‑public (not exposed to REST) and the DraftOrders code/hooks explicitly remove draft/auto‑draft from order queries, so the orders list API omits them by default.
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.
You are onto something, notice this comment:
// Draft orders are not returned from the API. We need to re-fetch order list from the API
// when the order is new or its status changed from draft to another status.
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.
Okay. I just tested on WooCommerce 10.2.0 and auto-drafts are not returned there. So this is apparently a change in the behavior of the API! I think we'll need to track whether it's intentional or not and either fix it or update the apps (not just POS, but even Order list).
Description
With this PR, we filter orders with draft statuses from the orders list, as they don't need to be shown to the users.
Test Steps
Open POS
Add a product to the cart
Tap on checkout
Tap on back
Tap on checkout
Complete the order
Open Order List – Before: there is one order in auto-draft and one completed. Now: Just one completed
I have considered if this change warrants release notes and have added them to
RELEASE-NOTES.txtif necessary. Use the "[Internal]" label for non-user-facing changes.