1and1 Help Centre Categories

print article

How to give discount to certain items based on a coupon code

Step 1
First create a textfield attribute for all the items in question. You can name it as "coupon_code". Open eShop -> Items -> edit -> next -> "+add" under "Additional item attributes"

Step 2
Create another attribute for the item, e.g. originalprice and assign the item
price as its value. For eg: if the item costs $75.00, the "originalprice" value will
be 75.

Step 3
Now enter the following rule under Items.
Open eShop -> Items -> edit -> next -> " Rule (valid PHP-Scriptcode, double quotes
are not permitted!) for this item"

if (article_get_field('coupon_code')=='1234567C')
article_set_field('price', article_get_field('originalprice') * 0.75);

So, in the above example, if a shopper enters the coupon code as 1234567C, then
he/she will receive 25% discount.

Note: It is very important that you create the attribute named "originalprice".