Skip to content
This repository has been archived by the owner on Sep 21, 2022. It is now read-only.

Disallow applying same discount code to a cart more than once #26

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from

Conversation

tedraykov
Copy link

Resolves reactioncommerce/reaction#6482
Impact: minor
Type: bugfix

Issue

A discount code can be applied multiple times to a single cart.

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.

Would like to see a test here

billing.data &&
billing.data.discountId === discount._id);

if (match) throw new ReactionError("discount-error", `Code ${discount.code} is already applied to cart`);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could we write a test for this new function?

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

Successfully merging this pull request may close these issues.

disallow applying same discount code to a cart more than once
2 participants