DiscountManager
class DiscountManager implements DiscountManagerInterface (View source)
Properties
protected null|Channel> | $channels | The current channels. |
|
protected null|CustomerGroup> | $customerGroups | The current customer groups |
|
protected | $discounts | The available discounts |
|
protected array | $types | The available discount types |
|
protected | $applied | The applied discounts. |
Methods
Instantiate the class.
Set a single channel or a collection.
Set a single customer group or a collection.
Return the applied channels.
Return the applied customer groups.
Add a discount type by classname
Return the available discount types.
Return the applied discounts
Validate a given coupon against all system discounts.
Details
__construct()
Instantiate the class.
DiscountManager
channel(Channel|iterable $channel)
Set a single channel or a collection.
DiscountManager
customerGroup(CustomerGroup|iterable $customerGroups)
Set a single customer group or a collection.
Collection
getChannels()
Return the applied channels.
Collection
getDiscounts(Cart $cart = null)
Returns the available discounts.
Collection
getCustomerGroups()
Return the applied customer groups.
DiscountManagerInterface
addType(string $classname)
Add a discount type by classname
Collection
getTypes()
Return the available discount types.
DiscountManagerInterface
addApplied(CartDiscount $cartDiscount)
Add an applied discount
Collection
getApplied()
Return the applied discounts
bool
validateCoupon(string $coupon)
Validate a given coupon against all system discounts.