Add trigger to update total cost