add total function to cart