Code
Whenever you're dealing with a code in your template, you're actually working with a Code object.
Properties
Type: int|null
ID of the code.
Type: int|null
The Voucher ID the code is generated for.
Type: verbb\giftvoucher\elements\Voucher|null
The Voucher the code is generated for.
The voucher's type the code is generated for.
Type: int|null
The Order (opens new window) ID where the parent voucher was originally purchased from.
Type: craft\commerce\elements\Order|null
The Order (opens new window) where the parent voucher was originally purchased from.
Type: int|null
The Line Item (opens new window) ID in the order where the parent voucher was originally purchased from.
Type: craft\commerce\models\LineItem|null
The Line Item (opens new window) in the order where the parent voucher was originally purchased from.
Type: string|null
The generated, unique code used for redeeming this amount.
Type: float|null
When the voucher is purchased initially, the amount is stored under this value. This cannot be updated.
Type: float|null
The current amount of the code. Because vouchers can be redeemed multiple times, this amount can be used all at once, or over a few orders depending on the value. This value will be updated with each redemption.
Type: DateTime|null
The date this code will no longer be available for use.
Methods
Returns: string|null
The url to edit this code in the control panel.
Returns: array
Shows a list of all redemptions for that code. This keeps track of what orders and products this code has been used against.