$wsVoucher module, you can use and display voucher data dynamically in the frontend. You can list redeemed vouchers, calculate the total value, and load details for individual vouchers. In this section, you will learn how to retrieve voucher data and display it in the basket or checkout.
Module overview
Example / excerpt of$wsVoucher
ƒ() denotes a function.
Variables and methods overview
Templates
Voucher data can generally be loaded and displayed in any template. Entering or redeeming a voucher code is possible throughout the shop. However, it is most useful within the ordering process or in the basket.Variables
$wsVoucher.vouchers
Returns a list of all vouchers that the customer has redeemed in the current basket.$wsVoucher.totalValue
Returns the total value of the redeemed vouchers.$wsVoucher.totalUsedValue
Returns the voucher value already deducted from the basket.$wsVoucher.maximumCount
Returns the maximum number of vouchers that a customer may redeem at the same time.Methods
$wsVoucher.load()
Loads a voucher by its ID. Signature$wsVoucher.load(id)
Return valueMap - Voucher map with the voucher data.
Parameters
Example that loads a voucher:
By using the
$wsVoucher.load() function, various variables are available to retrieve and output voucher data. Below is an overview of which variables are available.