nopSolutions / nopCommerce

ASP.NET Core eCommerce software. nopCommerce is a free and open-source shopping cart.
https://www.nopcommerce.com
Other
9.16k stars 5.27k forks source link

Discount applied N times per cart #7259

Open danFbach opened 1 month ago

danFbach commented 1 month ago

I've searched the forums and made a post related to this, but I don't believe this is possible with the current code base.

I'm trying to build a discount rule that allows a discount rule to be applied once per cart.

With a discount like: image With many products assigned to it as eligible for discount, the first item of each product is discounted at 100%.

I want it to only discount ONE of MANY, once per cart.

I'm trying to build a discount rule to support this, but there is no information available in the DiscountRequirementValidationRequest model about what discounts have already been applied to the cart and if one were to try to parse the cart again, it would result in stack overflow because you would eventually call that DiscountRequirement again which would call it self again...

I thought about storing a temp setting saying discount x is applied on customer y's cart, on product z, but since the DiscountRequirementValidationRequest model doesn't contain any info about the product it is validating for either, this isn't possible.

Am I missing something that could be used to enable a function like this? From what I've tried, I think something needs to be changed outside of the plugin area to support a function like this.

AndreiMaz commented 1 month ago

https://www.nopcommerce.com/en/boards/topic/99569/apply-discount-once-per-cart