CoreShop
CoreShop copied to clipboard
CartAwareConditionCheckerInterface
Q | A |
---|---|
Bug report? | no |
Feature request? | yes |
BC Break report? | no |
RFC? | yes |
Shops typically want to inform users about opportunities for them, like written discounts
20% off the price for 10 or more bought
Currently, \CoreShop\Component\Product\Rule\Fetcher\ValidRulesFetcherInterface::getValidRules
will return price rules which are valid currently. For example, if you make a rule like the above, you'd say:
conditions:
- quantity:
minQuantity: 10
actions:
- discountPercent:
percent: 20
This is correct in the cart, in the order, in the quote and (to a degree) on the product page, where the new price, the discount etc show up after you've added 10 items in the cart.
But, you actually need a way to get the user to put 10 items in the cart to begin with. They should see the notice to the product view, maybe also in the cart (next to the quantity input), etc.
This could even go a bit further, you can have rules like
20% off the price for 10 or more 30% off the price for 50 or more
If you have 10 in the cart already, you'd get to examine the other rules and find the next threshold where the next discount triggers (this would require some custom work, but Coreshop could provide access to applicable rules)
Proposal
The proposal here is to create the new interface which extends the existing one and mark all conditions checkers which inspect the cart with it. We can then introduce a new type of valid rules checker which is to be used for this purpose.