Skip to content
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

Fix "Discounts not displayed properly in Orders panel" bug #2773 #2980

Merged
merged 5 commits into from
Oct 3, 2017

Conversation

efalayi
Copy link
Contributor

@efalayi efalayi commented Sep 29, 2017

Resolves #2773
"Add Discount" is displayed but the actual discount amount is not

Add Discount is a tag link which when clicked displays a form or list of discount codes
Total displayed does not reflect discount (if included)

Fix
  • Register component that displays discount lists/form
registerComponent("DiscountList", discountListComponent);
  • Replace Add Discount tag with discount amount
 {formatPriceString(invoice.discounts)}
  • Update getTotalByShop function to include discount amount
const discount = parseFloat(this.getDiscounts());
const discountTotal = Math.max(0, shopSubtotal - discount);
const shopTotal = discountTotal + shopTaxes + shipping;
Test
Login as an admin and set up shipping and payment methods
Add a discount code
Check out and use that code
Go to orders panel
Observe that discount amount is displayed

Esther Falayi added 3 commits September 28, 2017 12:43
Copy link
Collaborator

@brent-hoover brent-hoover left a comment

Choose a reason for hiding this comment

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

Let's just backout the change to getTotalsByShop and this looks good to go. Discounts are showing up properly in a single-shop.

@@ -203,14 +203,16 @@ export const cartOrderTransform = {
const subtotals = this.getSubtotalByShop();
const taxes = this.getTaxesByShop();
const shipping = parseFloat(this.getShippingTotal());
const discount = parseFloat(this.getDiscounts());
Copy link
Collaborator

Choose a reason for hiding this comment

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

I know I said we should be reflecting discount everywhere but this is actually the exception. We haven't finalized how we are handling discounts in a multi-shop scenario and I think this is going to give us odd results, so let's back out this change for now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@zenweasel when I add a discount, it's not reflected in Total displayed on Orders page.

@joykare
Copy link
Contributor

joykare commented Oct 2, 2017

@efalayi ready for a review?

@brent-hoover
Copy link
Collaborator

@efalayi Can you add a little more context to your comment. In a multi-shop scenario or? Where on the orders page using what payment provider? When I tested it in a single shop I was seeing the discount show up

@efalayi
Copy link
Contributor Author

efalayi commented Oct 2, 2017

@zenweasel here are screenshots of an order I just made
admin-screen
completed-order

Observe total displayed. They do not match.
This is a single shop scenario.

@brent-hoover
Copy link
Collaborator

Added this issue #3005 for Stripe, will deal with separately.

@brent-hoover brent-hoover merged commit cd26723 into marketplace Oct 3, 2017
@brent-hoover brent-hoover deleted the esther-fix-issue-2773 branch October 3, 2017 03:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants