-
Notifications
You must be signed in to change notification settings - Fork 117
[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
[POS Orders] Persist sales channel filter in order settings #15891
Conversation
|
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.
The sales channel filer is persisted after relaunching the app & switching stores as expected!
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 |
---|---|
![]() |
![]() |
/// Used to filter orders by sales channel | ||
/// | ||
public enum SalesChannelFilter: String, Codable, Hashable { | ||
case pointOfSale = "pos-rest-api" |
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.
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
.
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.
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" |
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.
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.
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.
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.
Thanks for the review!
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. |
Closes WOOMOB-711
Description
This PR adds persistence between sessions to the sales channel filter.
Testing information
Filter
and select any combination of filters that include thePoint of Sale
option, then tap onShow orders
.Filter history
icon, observe that has been logged accordingly.Screen.Recording.2025-07-10.at.18.02.59.mov
RELEASE-NOTES.txt
if necessary.