1and1 Help Centre Categories

print article

How to make sure only a certain quantity is ordered

You can decide on the quantity of items a shopper buys. For example, you can write a
rule, that allows a shopper to order only one quantity for a particular item. If a
shopper says 2, the Order button is hidden.

You need to write a rule for the item in question. (Items -> New/Edit -> Next -> Rule


if (($already_in_basket + article_get_field('count')) > 1) {
article_set_field('HIDE_ORDERBUTTON', TRUE);
article_set_field('hint','Note: You can only order 1 quantity for this item. Please change the quantity back to 1 and click Update');
} else {
article_set_field('HIDE_ORDERBUTTON', FALSE);
article_set_field('hint','');
};
In the above example a shopper is allowed to only order 1 Nokia 7610. If the quantity entered is more than 1, then the Order button is hidden.

If changed back to 1, the Order button shows up.