Code#

Whenever you're dealing with a code in your template, you're actually working with a Code object.

Attributes#

AttributeDescription
idID of the code.
voucherIdThe Voucher ID the code is generated for.
voucherThe Voucher the code is generated for.
voucherTypeThe voucher's type the code is generated for.
orderIdThe Order (opens new window) ID where the parent voucher was originally purchased from.
orderThe Order (opens new window) where the parent voucher was originally purchased from.
lineItemIdThe Line Item (opens new window) ID in the order where the parent voucher was originally purchased from.
lineItemThe Line Item (opens new window) in the order where the parent voucher was originally purchased from.
codeKeyThe generated, unique code used for redeeming this amount.
originalAmountWhen the voucher is purchased initially, the amount is stored under this value. This cannot be updated.
currentAmountThe 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.
expiryDateThe date this code will no longer be available for use.

Methods#

MethodDescription
getCpEditUrl()The url to edit this code in the control panel.
getRedemptions()Shows a list of all redemptions for that code. This keeps track of what orders and products this code has been used against.

Previous ← Voucher Next Events →