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: only highest eligible coupon applied #38416

Merged
merged 5 commits into from
Dec 6, 2023

Conversation

sandratridz
Copy link
Contributor

In POS and E-commerce of ERPNext, it only applies the pricing rule from the highest eligible coupon code entered by the user. Any other lower-value coupon codes entered have no effect.

For example, if a user enters the 20% off coupon code for orders over the value of 1000 when placing an order worth 2000, that 20% off coupon is ignored and no discount is applied. Only if the user specifically enters the code for the 30% off coupon eligible for orders over the value of 1500 will a discount be applied.

Steps to reproduce the coupon bug

  1. Create two coupons in the system:

    • Coupon code "20OFF" that gives 20% off orders over value of 1000.

    • Coupon code "30OFF" that gives 30% off orders over value of 1500.

  2. Add an items to the cart/invoice over the threshold for both coupons (ex: 2,000)

  3. Apply the lower value coupon code on the checkout page (enter "20OFF" in the coupon code field)

  4. The subtotal does not change/no discount is applied.

  5. Enter the higher value coupon code instead (enter "30OFF")

  6. The appropriate 30% discount based on the order subtotal is now applied.

  7. Confirm that when only the lower value coupon code is applied, no discount is given.

  8. Confirm that a discount is only applied when the higher value eligible coupon code is used.

@github-actions github-actions bot added the needs-tests This PR needs automated unit-tests. label Nov 29, 2023
@deepeshgarg007 deepeshgarg007 marked this pull request as ready for review November 30, 2023 04:52
Copy link

codecov bot commented Nov 30, 2023

Codecov Report

Merging #38416 (b454560) into develop (9424bbc) will decrease coverage by 0.01%.
The diff coverage is 0.00%.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop   #38416      +/-   ##
===========================================
- Coverage    60.16%   60.16%   -0.01%     
===========================================
  Files          759      759              
  Lines        69475    69480       +5     
===========================================
  Hits         41800    41800              
- Misses       27675    27680       +5     
Files Coverage Δ
erpnext/accounts/doctype/pricing_rule/utils.py 74.82% <0.00%> (-0.91%) ⬇️

sandratridz and others added 2 commits December 1, 2023 10:28
fix: only highest eligible coupon code applied

Co-authored-by: Rucha Mahabal <ruchamahabal2@gmail.com>
fix: only highest eligible coupon code applied

Co-authored-by: Rucha Mahabal <ruchamahabal2@gmail.com>
@ankush
Copy link
Member

ankush commented Dec 4, 2023

@Mergifyio update

Copy link
Contributor

mergify bot commented Dec 4, 2023

update

❌ Pull request can't be updated with latest base branch changes

Mergify needs the author permission to update the base branch of the pull request.
@tridz-dev needs to authorize modification on its head branch.

@ankush
Copy link
Member

ankush commented Dec 4, 2023

@sandratridz can you merge latest develop branch. And also please raise PRs from personal accounts in future.

https://github.com/frappe/erpnext/wiki/Pull-Request-Checklist#maintainer-edits

@deepeshgarg007 deepeshgarg007 merged commit d34787c into frappe:develop Dec 6, 2023
mergify bot pushed a commit that referenced this pull request Dec 6, 2023
* fix: application of pricing rule when coupon is used

(cherry picked from commit d34787c)
deepeshgarg007 pushed a commit that referenced this pull request Dec 7, 2023
fix: only highest eligible coupon applied (#38416)

* fix: application of pricing rule when coupon is used

(cherry picked from commit d34787c)

Co-authored-by: sandratridz <102575830+sandratridz@users.noreply.github.com>
frappe-pr-bot pushed a commit that referenced this pull request Dec 12, 2023
# [15.6.0](v15.5.0...v15.6.0) (2023-12-12)

### Bug Fixes

* `split_invoices_based_on_payment_terms` (backport [#37859](#37859)) ([#38488](#38488)) ([4b76cc4](4b76cc4))
* 1st row depr. sch. value of asset put to less than 180 days acc. to I.T. S. 32 (backport [#38696](#38696)) ([#38703](#38703)) ([2bd9671](2bd9671))
* auto delete draft serial and batch bundle (backport [#38637](#38637)) ([#38654](#38654)) ([b0675f6](b0675f6))
* close PO on SCO close (backport [#38667](#38667)) ([#38681](#38681)) ([4055543](4055543))
* format only if searched text contain link value text ([d79e6e3](d79e6e3))
* get customers for leaderboard ([9d5c79d](9d5c79d))
* get items for leaderboard ([7cb38a8](7cb38a8))
* get sales partner for leaderboard ([3845d42](3845d42))
* get sales person for leaderboard ([2fcfebe](2fcfebe))
* get suppliers for leaderboard ([e205772](e205772))
* ignore non-existing regional customizations (backport [#38621](#38621)) ([#38624](#38624)) ([c70e6f2](c70e6f2))
* limit end date to current date ([dbdb971](dbdb971))
* negative batch issue (backport [#38688](#38688)) ([#38694](#38694)) ([a75081b](a75081b))
* not able to make serial and batch using csv import (backport [#38659](#38659)) ([#38662](#38662)) ([dd07eca](dd07eca))
* only highest eligible coupon applied ([#38416](#38416)) ([aa66ee6](aa66ee6))
* serial and batch bundle permission (backport [#38618](#38618)) ([#38619](#38619)) ([ce2bd15](ce2bd15))
* serial no filter in the Serial No Ledger report (backport [#38669](#38669)) ([#38682](#38682)) ([d188c8e](d188c8e))
* Shipping Address Link Showing in Buying (backport [#38634](#38634)) ([#38646](#38646)) ([4150ed9](4150ed9))
* show stock qty in popup (backport [#38698](#38698)) ([#38699](#38699)) ([6e2cde4](6e2cde4))
* typeerror on new sites ([#38692](#38692)) ([9239e73](9239e73))
* typo in unittest ([#38673](#38673)) ([14ee13c](14ee13c))
* **ux:** don't update qty blindly (backport [#38608](#38608)) ([#38639](#38639)) ([0b2e2a2](0b2e2a2))

### Features

* add employee number to client user bootinfo (backport [#38477](#38477)) ([#38603](#38603)) ([c7dbcbc](c7dbcbc))
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 29, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
backport version-15-hotfix needs-tests This PR needs automated unit-tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants