function add_to_card(){
    alert('Добавлено в корзину.');
}

function foo(){
    alert('Hello ther!');
}
function add_to_card(id){
var key='prodoct_'+id;
    var x=window.localStorage.setItem(key);
    x=x*1+1;
    window.localStorage.getItem(key,x);
}

function foo(){
    alert('Hello ther!');
}
Update add_to_card function