When you're on a single voucher template, or looping through vouchers using craft.giftVoucher.vouchers()
, you're actually working with a GiftVoucher_VoucherModel
. This in turn extends Commerce's Purchasable (opens new window) object.
Outputting a GiftVoucher_VoucherModel
object in your template without attaching a property or method will return the product’s name:
<h1>{{ product }}</h1>
Voucher Models have the following attributes and methods:
The voucher name/title.
The id of the voucher in the system.
Returns this vouchers id - as vouchers are purchasables.
The voucher's product type.
The voucher's voucher type Id
The listing price of the voucher.
The sku of the voucher.
live, pending or expired based on postDate and expiryDate dates. Pending are vouchers with a future postDate date.
true or false
The tax category this voucher uses when their tax calculations are made.
The shipping category this voucher uses when their shipping calculations are made.
The date this voucher is available for sale.
The date this voucher will no longer be available for sale.
The url to edit this voucher.