Implement cart saving. See #1257.