-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
RFC - feat: Introduce filtering by orders total on the Admin UI #14146
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: develop
Are you sure you want to change the base?
RFC - feat: Introduce filtering by orders total on the Admin UI #14146
Conversation
…consistency
Based on the `createOperatorMap`, changed the operator key in selectedParams from `[operator]` to `[$${operator}]` to ensure consistent formatting across the filter logic (e.g `$lte` instead of `lte`)
- this points to the order_summary table
…lters - Introduced a new filter for `total` in the order table query and updated the filters to include it. - This enhancement allows users to filter orders based on the total amount.
🦋 Changeset detectedLatest commit: f3b5272 The changes in this PR will be included in the next version bump. This PR includes changesets to release 74 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
@adevinwild is attempting to deploy a commit to the medusajs Team on Vercel. A member of the Team first needs to authorize it. |
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.
This is the final PR Bugbot will review for you during this billing cycle
Your free Bugbot reviews will reset on December 17
Details
Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.
To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.
packages/admin/dashboard/src/components/table/data-table/data-table-filter/number-filter.tsx
Outdated
Show resolved
Hide resolved
adrien2p
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.
This looks good to me, do you have a video or screen shot of the result?
…efix in parsing logic
…r explicit versioning so far if we just try to filter summary total, it will get all versions, leading to potential inconsistency if you have multiple versions for an order when you want to filter by total
…pport for explicit versioning" This reverts commit 483dac7.
…keys to IDs Updated the filter processing logic to assign 'key' as 'id' when 'id' is not present, enhancing compatibility with existing filter structures. This change ensures that filters are correctly parsed and utilized in query parameters.
|
Ok fixed the filter issue that was setting |
|
@adrien2p here is the demo CleanShot.2025-12-01.at.16.45.08.yafw.balanced.mp4 |
adrien2p
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 man 🎉 should we add a new integration tests that filters with summary total on the order?
| z.number().optional() | ||
| ) | ||
| version: z.preprocess((val) => { | ||
| if (val && typeof val === "string") { |
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.
suggestion: could we use isString
…ing utility for improved type checking
…$gte, and $lte operators Implemented a series of tests to verify the functionality of filtering orders based on total using various operators. The tests cover matching and non-matching scenarios for each operator, ensuring accurate filtering behavior.
hey @adrien2p , I addressed the feedacks, is it ok to have a |
Yes thats alright, If I could make a suggestion it would be to maybe use |
I wasn't familiar with |


Summary
What — What changes are introduced in this PR?
This PR introduce filtering by order total on the Admin UI and on the API side using operators ($eq, $gte, $lte...)
Why — Why are these changes relevant or necessary?
Currently it is not possible
How — How have these changes been implemented?
To achieve this multiple parts of the code have been updated :
AdminGetOrdersParamsAPI validator had to be modified to accept thetotalkey, which will then be mapped to the correct field on theorder_summarytable (totalis mapped tosummary.totals.current_order_total, as it is the field synecd with the order's total)NumberFiltercomponent as it was not matching thecreateOperatorMapvalidator util ( operator was not inserted with prefix$for the API, e.ggtinstead of$gt)Testing — How have these changes been tested, or how can the reviewer test the feature?
Examples
You can filter orders using the API by doing so :
For example if you want to fetch all orders with a total of $100 :
If you want greater than $100 :
You get the idea, you can use all the common operators that are used in Medusa and listed here :
https://docs.medusajs.com/resources/service-factory-reference/tips/filtering#supported-filter-operators-list
Checklist
Please ensure the following before requesting a review:
yarn changesetand follow the promptsAdditional Context
Related to the following RFC
#14154
Note
Adds operator-based filtering by order total to the Admin Orders API and UI, with validator mapping, UI filter/operator fixes, query support, and tests.
AdminGetOrdersParamsto accepttotalwith operator maps and transform tosummary.totals.current_order_total.versionparsing to useisStringinvalidators.ts.NumberFilterto use$eq/$gt/$ltoperators and adjust display/parsing.totalnumber filter inuse-order-table-filters.tsx.totalinuse-order-table-query.tsxand JSON-parse its value.configurable-data-table.tsx, add filterid/keycompatibility and JSON-parse filter query params.totalusing$eq,$gte,$lteinintegration-tests/http/__tests__/order/admin/order.spec.ts.@medusajs/dashboardminor and@medusajs/medusapatch.Written by Cursor Bugbot for commit f3b5272. This will update automatically on new commits. Configure here.