I do use nopCommerce 3.9 and I would like to insert coupon code from my C# program code. There are requirements such as
"Has shopping cart amount"
and "Blocked on product".
The insert is working fine, I can see the inserted records and I think there are logically right. (The same process happening if I create Discount from Nop admin panel.)
When I open the inserted coupon from Nop admin the "Discount info" tab is perfect, on the "Requirements" tab I see the requirements
"Requirement Customer has x.xx amount in their shopping cart"
and the "Requirement Block Discount on Product", but without value.
If I modify the shopping cart value only (I don't modify the "blocked products" on purpose) and save it and reload the page, than everything is good. The blocked products are appeared too.
When I check the data tables I don't see any changes there. The records are the same as I inserted.
I guess there is another table(s), where I have to update something, but I cannot find which one it is.
I would appreciate for any help.
From the comments, I believe OP want to insert the new discount rule with two things:
And the issue is,
There are different tables for discount in nopCommerce.
Discount- main tableDiscountRequirement- stores requirement informationDiscount_AppliedToProducts- stores discounted products informationCreating a discount rule first time will add entry in discount table only. Then the id of discount table will be used for reference to the
DiscountRequirementandDiscount_AppliedToProductstable.