shopping list calculation function