Code Model#

When a customer has purchased a gift voucher, a Code Model will be automatically generated for each voucher in their cart. This model contains the unique code for other customers to use to obtain a discount on their purchases.

As such, you'll need this reference in particular when templating your PDF template, or showing the resulting voucher in your order summary or email templates.

Simple Output#

Outputting a GiftVoucher_CodeModel object in your template without attaching a property or method will simply return the generated code key.

<h1>{{ code }}</h1>

Voucher Models have the following attributes and methods:



The id of the code in the system.


The Voucher Model the code is generated for.


The voucher's type the code is generated for.


The Order Model (opens new window) where the parent voucher was originally purchased from.


The Line Item Model (opens new window) in the order where the parent voucher was originally purchased from.


The generated, unique code used for redeeming this amount.


When the voucher is purchased initially, the amount is stored under this value. This cannot be updated.


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.


The date this code will no longer be available for use.


This value indicates if the code was manually added.


The url to edit this code.


The url to edit the associated order.


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 Model Next Fetching Vouchers →