Skip to content

[POS Orders] Persist sales channel filter in order settings #15891

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

Merged
merged 3 commits into from
Jul 15, 2025

Conversation

iamgabrielma
Copy link
Contributor

@iamgabrielma iamgabrielma commented Jul 10, 2025

Closes WOOMOB-711

Description

This PR adds persistence between sessions to the sales channel filter.

Testing information

  • In a POS-eligible store, with existing POS orders (make a couple of new ones if not), tap on Filter and select any combination of filters that include the Point of Sale option, then tap on Show orders.
  • After loading, rerun the app
  • Navigate to orders, observe that the filter its persisted
  • Tap the Filter history icon, observe that has been logged accordingly.
Screen.Recording.2025-07-10.at.18.02.59.mov
Simulator Screenshot - iPad mini (A17 Pro) - US store - 2025-07-10 at 18 04 29
  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

@iamgabrielma iamgabrielma added type: task An internally driven task. feature: order list Related to the order list. feature: POS labels Jul 10, 2025
@iamgabrielma iamgabrielma added this to the 22.9 milestone Jul 10, 2025
@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Jul 10, 2025

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

App NameWooCommerce iOS Prototype
Build Numberpr15891-7cdb10b
Version22.7
Bundle IDcom.automattic.alpha.woocommerce
Commit7cdb10b
Installation URL6gmbgslta02ro
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

Base automatically changed from task/WOOMOB-711-make-view-for-sales-channel-filter to trunk July 14, 2025 05:41
@iamgabrielma iamgabrielma marked this pull request as ready for review July 14, 2025 08:53
@iamgabrielma iamgabrielma requested a review from jaclync July 14, 2025 08:53
Copy link
Contributor

@jaclync jaclync left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The sales channel filer is persisted after relaunching the app & switching stores as expected! :shipit:

I was wondering why some orders shown with POS sales channel filter didn't have the POS badge in a test store (just for one of the test stores) 🤔 For some other test stores, I also felt like there should be more POS orders but maybe the WC version was before 9.9 when created_via can be overridden remotely.

filter set to POS orders only only some orders had the POS badge
Simulator Screenshot - iPad (A16) - 2025-07-14 at 09 47 52 Simulator Screenshot - iPad (A16) - 2025-07-14 at 09 48 26

/// Used to filter orders by sales channel
///
public enum SalesChannelFilter: String, Codable, Hashable {
case pointOfSale = "pos-rest-api"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I think this value can be a value for the use case, instead of matching the created_via value in the networking layer. Like pos or point_of_sale with the same casing as other order filters like OrderDateRangeFilter.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True, I didn't realized we don't need the raw value from the API here, we just case match when creating the query on the OrderListViewModel and create the predicate we need from there. We actually don't need any raw value at all and can just use the enum case.

Let me know if you'd prefer to have some here for a specific case, otherwise I've removed these on 7cdb10b

@@ -51,6 +57,7 @@ public struct StoredOrderSettings: Codable, Equatable {
case dateRangeFilter = "date_range_filter"
case productFilter = "product_filter"
case customerFilter = "customer_filter"
case salesChannelFilter = "sales_channel_filter"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

non-blocking 💭 do you think we might update our naming to match the definition in pfZP8i-c4-p2#comment-158 at some point? If so, we might want to call it checkout_channel_filter in the storage. Naming for the code structs/classes/enums/vars can be changed anytime, while the storage value would require a migration or duplicated values for backward compatibility. Not a big deal if we have a legacy naming though.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question, this is something that I thought about when adding it. Since we do not know when we'll need these, or if the terms will change or evolve further before we do, I'd keep with sales_channel_filter for now. Later on we can decide if makes more sense to either keep the legacy naming or to make a migration if needed.

@iamgabrielma
Copy link
Contributor Author

Thanks for the review!

I was wondering why some orders shown with POS sales channel filter didn't have the POS badge in a test store (just for one of the test stores) 🤔 For some other test stores, I also felt like there should be more POS orders but maybe the WC version was before 9.9 when created_via can be overridden remotely.

Yes, if the order was created before 9.9 or before we updated the core data model then it wouldn't show the badge since we're not backfilling pre-existing orders. We'll be adding this to the test plan in any case to confirm that nothing is off.

@iamgabrielma iamgabrielma enabled auto-merge July 15, 2025 03:39
@iamgabrielma iamgabrielma merged commit 640692c into trunk Jul 15, 2025
13 checks passed
@iamgabrielma iamgabrielma deleted the task/WOOMOB-712-pos-order-filter-persistence branch July 15, 2025 03:42
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. feature: POS type: task An internally driven task.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants