Skip to content

Conversation

willbouch
Copy link
Contributor

@willbouch willbouch commented Aug 27, 2025

WHAT: Small rework of the order details summary section

WHY: With the introduction of shipping promotions, it made sense to rework a little but the order details section in order to show better the discounts being applied

HOW: Reworked the sections in order to show the amounts and make sure the merchant can sum up everything and understand the totals

TESTING: Manually with a few orders covering multiple cases

CLOSES 1142

Copy link

changeset-bot bot commented Aug 27, 2025

🦋 Changeset detected

Latest commit: c424922

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 71 packages
Name Type
@medusajs/utils Patch
@medusajs/dashboard Patch
@medusajs/types Patch
@medusajs/framework Patch
@medusajs/modules-sdk Patch
@medusajs/orchestration Patch
@medusajs/workflows-sdk Patch
@medusajs/cli Patch
@medusajs/medusa-oas-cli Patch
integration-tests-http Patch
@medusajs/admin-bundler Patch
@medusajs/draft-order Patch
@medusajs/js-sdk Patch
@medusajs/medusa Patch
@medusajs/test-utils Patch
@medusajs/analytics Patch
@medusajs/api-key Patch
@medusajs/auth Patch
@medusajs/cache-inmemory Patch
@medusajs/cache-redis Patch
@medusajs/cart Patch
@medusajs/currency Patch
@medusajs/customer Patch
@medusajs/event-bus-local Patch
@medusajs/event-bus-redis Patch
@medusajs/file Patch
@medusajs/fulfillment Patch
@medusajs/index Patch
@medusajs/inventory Patch
@medusajs/link-modules Patch
@medusajs/locking Patch
@medusajs/notification Patch
@medusajs/order Patch
@medusajs/payment Patch
@medusajs/pricing Patch
@medusajs/product Patch
@medusajs/promotion Patch
@medusajs/region Patch
@medusajs/sales-channel Patch
@medusajs/settings Patch
@medusajs/stock-location Patch
@medusajs/store Patch
@medusajs/tax Patch
@medusajs/user Patch
@medusajs/workflow-engine-inmemory Patch
@medusajs/workflow-engine-redis Patch
@medusajs/analytics-local Patch
@medusajs/analytics-posthog Patch
@medusajs/auth-emailpass Patch
@medusajs/auth-github Patch
@medusajs/auth-google Patch
@medusajs/file-local Patch
@medusajs/file-s3 Patch
@medusajs/fulfillment-manual Patch
@medusajs/locking-postgres Patch
@medusajs/locking-redis Patch
@medusajs/notification-local Patch
@medusajs/notification-sendgrid Patch
@medusajs/payment-stripe Patch
@medusajs/core-flows Patch
@medusajs/oas-github-ci Patch
@medusajs/telemetry Patch
@medusajs/admin-sdk Patch
@medusajs/admin-shared Patch
@medusajs/admin-vite-plugin Patch
@medusajs/icons Patch
@medusajs/toolbox Patch
@medusajs/ui-preset Patch
create-medusa-app Patch
medusa-dev-cli Patch
@medusajs/ui Patch

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

Copy link

vercel bot commented Aug 27, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
medusa-dashboard Ready Ready Preview Comment Sep 2, 2025 2:24pm
8 Skipped Deployments
Project Deployment Preview Comments Updated (UTC)
api-reference Ignored Ignored Sep 2, 2025 2:24pm
api-reference-v2 Ignored Ignored Preview Sep 2, 2025 2:24pm
cloud-docs Ignored Ignored Preview Sep 2, 2025 2:24pm
docs-ui Ignored Ignored Preview Sep 2, 2025 2:24pm
docs-v2 Ignored Ignored Preview Sep 2, 2025 2:24pm
medusa-docs Ignored Ignored Preview Sep 2, 2025 2:24pm
resources-docs Ignored Ignored Preview Sep 2, 2025 2:24pm
user-guide Ignored Ignored Preview Sep 2, 2025 2:24pm

@willbouch willbouch changed the title feat(dashboard,types,utils): refine order details summary feat(dashboard,cart,types,utils): refine order details summary Aug 27, 2025
@@ -250,6 +243,7 @@ export function decorateCartTotals(
cart.item_total = new BigNumber(itemsTotal)
cart.item_subtotal = new BigNumber(itemsSubtotal)
cart.item_tax_total = new BigNumber(itemsTaxTotal)
cart.item_discount_total = new BigNumber(itemsDiscountTotal)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

added those 2 properties. It was a comment from @fPolic and I believe it is a good addition since I will be using it in the admin dashboard + the nextjs storefront

<Text className="text-ui-fg-subtle" size="small" leading="compact">
{t("fields.creditTotal")}
</Text>
{getTotalCreditLines(order.credit_lines ?? []) > 0 && (
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is a bit confusing, so will hide if 0 as requested by Oli

@willbouch
Copy link
Contributor Author

/snapshot-this

Copy link
Contributor

🚀 A snapshot release has been made for this PR

Test the snapshots by updating your package.json with the newly published versions:

yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]
yarn add @medusajs/[email protected]

Latest commit: 65dfcf9

@willbouch willbouch marked this pull request as ready for review August 28, 2025 14:13
@willbouch willbouch requested a review from a team as a code owner August 28, 2025 14:13
@willbouch
Copy link
Contributor Author

Please use the snapshot above to check for a few orders you might have locally. The more cases covered, the better. I have checked with taxes, without taxes, with discounts, no discounts, etc. but still. It is better to check for multiple cases across multiple projects

@willbouch willbouch marked this pull request as draft August 28, 2025 15:11
@willbouch willbouch requested review from fPolic and olivermrbl August 29, 2025 13:58
Copy link
Contributor

@fPolic fPolic left a comment

Choose a reason for hiding this comment

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

Looks good to me overall!

nit: draft orders have similar UI, should we add a ticket to revisit that as well

@willbouch
Copy link
Contributor Author

willbouch commented Aug 29, 2025

Looks good to me overall!

nit: draft orders have similar UI, should we add a ticket to revisit that as well

Will add a ticket yes. @olivermrbl would you prefer it being part of the same project? I am playing with the draft order ui right now and there seems to be many bugs. Maybe it should be part of another project to make this feature better

@olivermrbl
Copy link
Contributor

I am playing with the draft order ui right now and there seems to be many bugs. Maybe it should be part of another project to make this feature better

Would love to create a follow-up project to clean this up; let's sync Monday on this

Copy link
Contributor

@olivermrbl olivermrbl left a comment

Choose a reason for hiding this comment

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

Overall LGTM, few comments/suggestions.

order.items.forEach((item) =>
item.adjustments?.forEach((adj) => {
codes.add(adj.code)
const taxes = useMemo(() => {
Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion: I wanted to suggest a minor change here; instead of breaking down taxes by type (item, shipping), should we group them by the tax rate code? This seems to be a standard and is used by other platforms. See Shopify below:

CleanShot 2025-08-31 at 15 20 42@2x

As a consequence, this would mean we don't differentiate between item and shipping tax total, but we squash these two together.

The reasoning behind this is that, as a merchant, the type of tax doesn't really matter much; what matters is that the correct tax rates were applied to the order. E.g. in NYC, the number of tax lines get pretty wild, as you can see above, and in those scenarios, giving the merchant a tax total doesn't provide much insight into why the tax total got to where it is.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done
Screenshot 2025-09-02 at 10 13 52 AM

Copy link
Contributor

@olivermrbl olivermrbl left a comment

Choose a reason for hiding this comment

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

lfg, nice work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants