Skip to content
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

Orders: Show trash option in order status filter list #13974

Draft
wants to merge 6 commits into
base: trunk
Choose a base branch
from

Conversation

itsmeichigo
Copy link
Contributor

@itsmeichigo itsmeichigo commented Sep 16, 2024

Closes: #13973

Description

This PR adds the option to see orders in trash as per feature request from users.

Currently, we're fetching order statuses from wc/v3/reports/totals/orders. This endpoint returns all statuses of orders in a store, but doesn't include the trash status.

This PR adds the trash option manually to the order status filter list of the order list and last orders dashboard card. Orders with selected statuses including trash should be fetched as before from the wc/v3/orders endpoint.

Steps to reproduce

  • Log in to a test store with more than 1 order of different statuses.
  • Trash an order from wp-admin or from them app through the order detail screen.
  • In the Orders tab, select Filter > Order statuses > Trash (and other options if necessary).
  • Apply the filter(s) and confirm that the order list displays the correct orders matching the filter criteria.
  • Navigate the My Store tab and enable the Most recent orders card.
  • Tap on the filter icon and confirm that there's an option for Trash. Select that option.
  • Confirm that the correct results are displayed for Trash option.

Testing information

Tested on simulator iPhone 15 Pro iOS 17.4:

  • Confirmed that order list displays the correct results when selecting Trash status alone or together with other statuses/criteria.
  • Confirmed that clearing the filter showing the full order list without the trash orders.
  • Confirmed that selecting Trash in the most recent orders dashboard card displays the correct results.

Screenshots

\ Order list Last order dashboard card
Status options
Results

  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

Reviewer (or Author, in the case of optional code reviews):

Please make sure these conditions are met before approving the PR, or request changes if the PR needs improvement:

  • The PR is small and has a clear, single focus, or a valid explanation is provided in the description. If needed, please request to split it into smaller PRs.
  • Ensure Adequate Unit Test Coverage: The changes are reasonably covered by unit tests or an explanation is provided in the PR description.
  • Manual Testing: The author listed all the tests they ran, including smoke tests when needed (e.g., for refactorings). The reviewer confirmed that the PR works as expected on all devices (phone/tablet) and no regressions are added.

@itsmeichigo itsmeichigo added type: enhancement A request for an enhancement. feature: order list Related to the order list. labels Sep 16, 2024
@itsmeichigo itsmeichigo added this to the 20.5 milestone Sep 16, 2024
@dangermattic
Copy link
Collaborator

1 Message
📖 This PR is still a Draft: some checks will be skipped.

Generated by 🚫 Danger

@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Sep 16, 2024

WooCommerce iOS📲 You can test the changes from this Pull Request in WooCommerce iOS by scanning the QR code below to install the corresponding build.

App NameWooCommerce iOS WooCommerce iOS
Build Numberpr13974-b32b452
Version20.4
Bundle IDcom.automattic.alpha.woocommerce
Commitb32b452
App Center BuildWooCommerce - Prototype Builds #10896
Automatticians: You can use our internal self-serve MC tool to give yourself access to App Center if needed.

@itsmeichigo
Copy link
Contributor Author

@hichamboushaba This works well for me. LMK what you think of the solution.

@hichamboushaba
Copy link
Member

@hichamboushaba This works well for me. LMK what you think of the solution.

Thanks @itsmeichigo for the ping, I tested the feature on my iPhone, and I have some remarks:

  1. The trashed order is cached to the app's DB, so if I clear the filter, the trashed order will be shown for a little while, and also if the fetch failed, it will be shown indefinitely until we refresh the content later, the order was even kept after restarting the app when my phone didn't have a working connection.
RPReplay_Final1726651038.mov
  1. We can make changes to the order, while in wp-admin we can't, the only thing we can do in wp-admin is restore the order, we can't even open the order details, and if you try to hijack your way into the order details by entering the URL manually, you get the following error:
Screenshot 2024-09-18 at 10 22 45

WDYT about these issues @itsmeichigo, are they blockers? For Android, if we decide to still follow this approach, I was planning on finding a way to avoid caching the trashed orders and always fetch them from network, which should fix (1), but I'm not sure it'll be straightforward.

@hichamboushaba
Copy link
Member

One additional issue with the current implementation, but it's a point that can be fixed, we need to offer a way to restore the order, requiring the user to change the status manually to restore the order is not user-friendly, and also it doesn't allow the user to restore the old status, instead, we should offer a Restore button that changes the order status to the previous value using the metadata key _wp_trash_meta_status.

@itsmeichigo
Copy link
Contributor Author

@hichamboushaba I responded in an internal thread: p1726800244113699-slack-C03L1NF1EA3.

@wpmobilebot wpmobilebot modified the milestones: 20.5, 20.6 Sep 20, 2024
@wpmobilebot
Copy link
Collaborator

Version 20.5 has now entered code-freeze, so the milestone of this PR has been updated to 20.6.

@wpmobilebot wpmobilebot modified the milestones: 20.6, 20.7 Sep 27, 2024
@wpmobilebot
Copy link
Collaborator

Version 20.6 has now entered code-freeze, so the milestone of this PR has been updated to 20.7.

@wpmobilebot wpmobilebot modified the milestones: 20.7, 20.8 Oct 11, 2024
@wpmobilebot
Copy link
Collaborator

Version 20.7 has now entered code-freeze, so the milestone of this PR has been updated to 20.8.

@wpmobilebot wpmobilebot modified the milestones: 20.8, 20.9 Oct 18, 2024
@wpmobilebot
Copy link
Collaborator

Version 20.8 has now entered code-freeze, so the milestone of this PR has been updated to 20.9.

@itsmeichigo itsmeichigo removed this from the 20.9 milestone Oct 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature: order list Related to the order list. type: enhancement A request for an enhancement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Order: Add option to show trash orders
4 participants