Skip to main content
With this function, you tie a voucher to availability. It then applies only to products whose traffic light status matches a list you specify. The practical benefit usually lies in clearing stock: a voucher that only works on green products steers demand towards what is plentiful in stock rather than towards what is already scarce.

How the check works

The shop determines the current traffic light status for each basket item and compares it with your list. One matching item is enough for the voucher to be accepted. If none matches, the shop rejects it.
The status is calculated at the moment of redemption, not when the voucher is created. A voucher that still worked yesterday may be rejected today because the product has since dropped from green to yellow. Plan such promotions with a buffer from the threshold values.
If the shop is configured so that the ordered quantity affects the delivery status, a higher quantity shifts the status downwards. The same customer may then be able to redeem their voucher for one item but no longer for ten.
Products for which no traffic light status can be determined never meet the condition. A basket consisting entirely of such products always leads to rejection.
This filter does not recognize the finer gradations red-hard and red-soft that exist for display in the template. Only red counts here.

Prerequisite

The voucher generator must be activated. Contact your WEBSALE representative to arrange this.
If the vouchers come from an external system and are therefore not in WEBSALE format, add the entry ExternalVouchers-Allow = yes in the <Voucher-Txt> section of the shop.config.
Guide: Providing voucher entry · Reference: Voucher-Txt section

Step 1: Create the filter in the voucher

When creating the voucher in the voucher generator, enter a string following the scheme below in the Kundenspezifische Features (custom features) field at the very bottom.
In this example, the voucher applies to products with a green or yellow traffic light status.
If <valueList> remains empty, the function is not active and the voucher applies without restriction. The shop does not report this. Anyone who meant to set the filter and makes a typo gives away the discount on the entire product range.

Behavior for set products

Only the value single is evaluated. Any other value and an empty entry mean asUnit. A typo in single therefore silently results in unit behavior.

Step 2: Add the error message

If no basket item matches the filter, the shop rejects the voucher with reason 22. Add this reason wherever you have integrated the voucher entry, i.e. on the basket page ws_basket.htm or the order overview page ws_place_order.htm.
Word this text carefully. Unlike with a product-dependent voucher, the customer cannot see the condition, because the traffic light status is not shown everywhere in the shop. A hint as to which products are meant helps them more than a bare rejection.
Reference: MSG-Voucher_error

Step 3: Output the configuration in the template (optional)

For verification, you can display which stock levels an entered voucher is tied to.
As a standalone tag, VOUCHER-SpecialFeatures_InventoryState_SetBehavior outputs a number, 0 for asUnit and 1 for single. In the example, the query with a parameter translates the number into plain text so that the page does not show “Behavior for set products: 0”.
VOUCHER-SpecialFeatures_InventoryState_ValueList outputs the list with a leading and trailing comma, i.e. ,green,yellow,. This is how it is stored internally so that the shop can check for whole values. For display purposes, remove the outer commas.
Reference: VOUCHER-SpecialFeatures_InventoryState · VOUCHER-SpecialFeatures_InventoryState_SetBehavior · VOUCHER-SpecialFeatures_InventoryState_ValueList
  • Guide: Offering vouchers: Overview
  • Guide: Creating or importing vouchers
  • Guide: Providing voucher entry
  • Guide: Vouchers depending on product data