Voucher#

Whenever you're dealing with a vouchers in your template, you're actually working with a Voucher object.

Attributes#

AttributeDescription
idID of the voucher.
titleThe voucher name/title.
nameThe voucher name/title.
urlThe URL to this single voucher.
purchasableIdReturns this vouchers id - as vouchers are purchasables.
typeThe voucher's product type.
typeIdThe voucher's voucher type ID
priceThe listing price of the voucher.
customAmountWhether this voucher should have a custom (user-provided) amount.
skuThe sku of the voucher.
statuslive, pending or expired based on postDate and expiryDate dates. Pending are vouchers with a future postDate date.
enabledtrue or false
taxCategoryIdThe ID for the tax category this voucher uses when their tax calculations are made.
taxCategoryThe tax category this voucher uses when their tax calculations are made.
shippingCategoryIdThe ID for the shipping category this voucher uses when their shipping calculations are made.
shippingCategoryThe shipping category this voucher uses when their shipping calculations are made.
postDateThe date this voucher is available for sale.
expiryDateThe date this voucher will no longer be available for sale.

Methods#

MethodDescription
getCpEditUrl()The url to edit this voucher in the control panel.
getPdfUrl(LineItem $lineItem, $option = null)Get the PDF URL for this voucher and Line Item (opens new window).
getCodes(LineItem $lineItem)Get all Code's for a provided Line Item (opens new window) and voucher.
getProduct()Convenience method for native Commerce product behaviour.

Previous ← Code Queries Next Code →