Non e' chiara la domanda... non basta un semplice if ?

if(totale<2) {
alert("minimo 2 mq!");
totale = 2;
}