Virtual_Coupon

Responsible for creating a virtual coupon based on a discount.

This is used to apply the discount to admin orders.

Tags
author

Barn2 Plugins support@barn2.com

license

GPL-3.0

copyright

Barn2 Media Ltd

Table of Contents

$coupon  : WC_Coupon
The coupon object.
$discount  : Discount
The discount that this coupon is based on.
$discount_amount  : float
The amount of the discount.
$order  : WC_Order|bool
The order that this coupon is being applied to.
__construct()  : mixed
Constructor.
get_amount()  : float
Get the reduction amount.
get_discount()  : Discount
Get the discount that this coupon is based on.
get_order()  : WC_Order|bool
Get the order that this coupon is being applied to.
set_order()  : self
Set the order that this coupon is being applied to.
setup_coupon()  : WC_Coupon
Setup and return the coupon object.

Properties

$discount_amount

The amount of the discount.

public float $discount_amount = 0

$order

The order that this coupon is being applied to.

protected WC_Order|bool $order = false

Methods

__construct()

Constructor.

public __construct(Discount $discount, WC_Coupon $coupon, float $discount_amount) : mixed
Parameters
$discount : Discount

The discount that this coupon is based on.

$coupon : WC_Coupon

The coupon object.

$discount_amount : float

The amount of the discount.

Return values
mixed

get_amount()

Get the reduction amount.

public get_amount() : float
Return values
float

get_order()

Get the order that this coupon is being applied to.

public get_order() : WC_Order|bool
Return values
WC_Order|bool

set_order()

Set the order that this coupon is being applied to.

public set_order(WC_Order $order) : self
Parameters
$order : WC_Order

The order.

Return values
self

setup_coupon()

Setup and return the coupon object.

public setup_coupon() : WC_Coupon
Return values
WC_Coupon

Search results