question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Wrong prices after coupon code in cart/checkout

See original GitHub issue

Current behavior

When entering a coupon code in checkout that has the setting in magento 2: “Deduct 5€ for whole cart” then the prices on the products are wrong:

image

Expected behavior

The price of the products in cart should not change if the coupon deducts from grand total… only if coupon is for product

Steps to reproduce the issue

Repository

Can you handle fixing this bug by yourself?

  • YES
  • NO

Which Release Cycle state this refers to? Info for developer.

Pick one option.

  • This is a bug report for test version on https://test.storefrontcloud.io - In this case Developer should create branch from develop branch and create Pull Request 2. Feature / Improvement back to develop.
  • This is a bug report for current Release Candidate version on https://next.storefrontcloud.io - In this case Developer should create branch from release branch and create Pull Request 3. Stabilisation fix back to release.
  • This is a bug report for current Stable version on https://demo.storefrontcloud.io and should be placed in next stable version hotfix - In this case Developer should create branch from hotfix or master branch and create Pull Request 4. Hotfix back to hotfix.

Environment details

  • Browser:
  • OS:
  • Node:
  • Code Version: 1.11.4

Additional information

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
teuma86commented, Aug 18, 2020

Just to further explain the fix as this theme is no longer available to review the code

<div class="prices" v-if="!displayItemDiscounts || !isOnline"> <span class="h4 serif cl-error price-special" v-if="product.special_price"> {{ product.price_incl_tax * product.qty | price(storeView) }} </span> <span class="h6 serif price-original" v-if="product.special_price"> {{ product.original_price_incl_tax * product.qty | price(storeView) }} </span> <span class="h4 serif price-regular" v-else data-testid="productPrice"> {{ (product.original_price_incl_tax ? product.original_price_incl_tax : product.price_incl_tax) * product.qty | price(storeView) }} </span> </div> <div class="prices" v-else-if="isOnline && product.totals"> <span class="h4 serif cl-error price-special" v-if="product.totals.discount_amount"> {{ product.totals.row_total - product.totals.discount_amount + product.totals.tax_amount | price(storeView) }} </span> <span class="h6 serif price-original" v-if="product.totals.discount_amount"> {{ product.totals.row_total_incl_tax | price(storeView) }} </span> <span class="h4 serif price-regular" v-if="!product.totals.discount_amount"> {{ product.totals.row_total_incl_tax | price(storeView) }} </span> </div> <div class="prices" v-else> <span class="h4 serif price-regular"> {{ (product.regular_price || product.price_incl_tax) * product.qty | price(storeView) }} </span> </div> </div>

Note displayItemDiscounts is a computed property which returns config.cart.displayItemDiscounts

If this is true, you will fall into the else-if section which uses product.totals.discount_amount

With Magento storing cart item discounts against the quote item as discount_amount. This results in the issue reported.

Thanks

Jamie

Read more comments on GitHub >

github_iconTop Results From Across the Web

Wrong prices after coupon code in cart/checkout #4460 - GitHub
Current behavior When entering a coupon code in checkout that has the setting in magento 2: "Deduct 5€ for whole cart" then the...
Read more >
Cart discount price is incorrect - WordPress.org
I have set up quantity discount pricing using the following tutorial: ... PS: My bad I mentioned Cart/checkout page shows incorrect amount by...
Read more >
Applying Coupon Code After Refreshing Checkout ... - Drupal
The error/notice only appears: 1. The first time I try entering a coupon code after a /cart/checkout page refresh
Read more >
Managing conditional coupons and additional fees on cart ...
The problem I have is that part concernign the management of teh discount coupon doesn't work. It gets the $coupon_code and $coupon_amount, but ......
Read more >
Fix issues with disapproved promotions - Google Support
Possible causes: There's no redemption code associated with the specific promotion. How to troubleshoot: Add a valid coupon code in your promotion's details....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found