class BuyXGetY extends AbstractDiscountType (View source)

Properties

$discount

The instance of the discount.

from  AbstractDiscountType

Methods

with(Discount $discount)

Set the data for the discount to user.

markAsUsed(Cart $cart)

Mark a discount as used

Collection
getEligibleLines(Cart $cart)

Return the eligible lines for the discount.

bool
checkDiscountConditions(Cart $cart)

Check if discount's conditions met.

addDiscountBreakdown(Cart $cart, DiscountBreakdown $breakdown)

Check if discount's conditions met.

int
usesByUser(Authenticatable $user)

Check how many times this discount has been used by the logged in user's customers

string
getName()

Return the name of the discount.

int
getRewardQuantity(int $linesQuantity, int $minQty, int $rewardQty, int $maxRewardQty = null)

Return the reward quantity for the discount

apply(Cart $cart)

Called just before cart totals are calculated.

Details

AbstractDiscountType with(Discount $discount)

Set the data for the discount to user.

Parameters

Discount $discount

Return Value

AbstractDiscountType

AbstractDiscountType markAsUsed(Cart $cart)

Mark a discount as used

Parameters

Cart $cart

Return Value

AbstractDiscountType

protected Collection getEligibleLines(Cart $cart)

Return the eligible lines for the discount.

Parameters

Cart $cart

Return Value

Collection

protected bool checkDiscountConditions(Cart $cart)

Check if discount's conditions met.

Parameters

Cart $cart

Return Value

bool

protected AbstractDiscountType addDiscountBreakdown(Cart $cart, DiscountBreakdown $breakdown)

Check if discount's conditions met.

Parameters

Cart $cart
DiscountBreakdown $breakdown

Return Value

AbstractDiscountType

protected int usesByUser(Authenticatable $user)

Check how many times this discount has been used by the logged in user's customers

Parameters

Authenticatable $user

Return Value

int

string getName()

Return the name of the discount.

Return Value

string

int getRewardQuantity(int $linesQuantity, int $minQty, int $rewardQty, int $maxRewardQty = null)

Return the reward quantity for the discount

Parameters

int $linesQuantity
int $minQty
int $rewardQty
int $maxRewardQty

Return Value

int

Cart apply(Cart $cart)

Called just before cart totals are calculated.

Parameters

Cart $cart

Return Value

Cart