Improve cart update performance. Closes #3495.