var q = (tags['volumediscount'] > 0) ? tags['volumediscount'] : quantity;

if (q >= 20) {
 12;
} else if (q >= 10) {
 14;
} else if (q >= 3) {
 16;
} else {
 18;
}