-
-
Notifications
You must be signed in to change notification settings - Fork 827
feat(): handle free shipping in cart display #508
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
Conversation
The latest updates on your projects. Learn more about Vercel for GitHub.
|
{!!discount_total && ( | ||
<div className="flex items-center justify-between"> | ||
<span>Discount</span> | ||
<span>Subtotal (excl. shipping and taxes)</span> |
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 part is weird. It says "excl. shipping and taxes" but then we display subtotal
which has shipping costs inside. Looks like a bug to me
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.
Should this be "excl. discount and taxes"?
Also, it's a bit odd that the subtotal is crossed since nothing is "reduced" from the subtotal when a discount is applied - should we cross the total instead?
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.
it could be the 3. Cause there is also no shipping. However, I am more used to seeing "excl. discount and taxes" in other websites. I guess the reason would be to not shove into someone's face that they didn't get a discount ahha
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.
I see what you mean about the subtotal crossed. Idk, I checked with Ludvig and we settled on this way. I think that crossing the total could more confusing though no? You would see something like
subtotal 10$
shipping 100$
taxes 0$
total 110$ 104$
You don't really know where the promotion comes from I guess? Although with "subtotal", I kind of assume that promotion comes from the items directly
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.
@olivermrbl you can let me know what you think
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.
Hmm, first of all, should subtotal
contain shipping? This seems like a potential mishap from our side, if we include shipping in the core. Subtotal is typically the sum of the subtotal of items.
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.
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.
Yeah, exactly. We need to update the core then. Could I get you to open a ticket for this?
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.
ah ok I see what you mean. Can I do it while reworking the totals?
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.
Yes sure!
const totalItemDiscount = items?.flatMap(i => i.adjustments).reduce((acc, curr) => (curr?.amount || 0) + acc, 0) | ||
const totalShippingDiscount = shipping_methods?.flatMap(sm => sm.adjustments).reduce((acc, curr) => (curr?.amount || 0) + acc, 0) |
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.
tought: should we introduce these as separate total props on cart/order in the future
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.
Will be reworking the totals section and the order details section. I believe what you are saying would make sense. If I go that route, I will come back to change it here after I do it in the admin dashboard
{!!discount_total && ( | ||
<div className="flex items-center justify-between"> | ||
<span>Discount</span> | ||
<span>Subtotal (excl. shipping and taxes)</span> |
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.
Should this be "excl. discount and taxes"?
Also, it's a bit odd that the subtotal is crossed since nothing is "reduced" from the subtotal when a discount is applied - should we cross the total instead?
Handled a nicer way the cart for promotions. Here is what it looks like when there is a promotion on items:

And this is when the discount is free shipping:

Still waiting for approval from design team but it should be ok
CLOSES CORE-1132