Share cart across devices/browsers

Vote:
 

Hi there,

I have a case where I would like to share an "anonymous" cart across devices. Here it is possible for me to send "CustomerId" in a QueryString to the other device.

I use this code to share the cart between devices:

public ICart CloneAndLoadCart(Guid customerId)
        {
            var existingCart = _orderRepository.LoadCart<ICart>(customerId, DefaultCartName, _currentMarket);

            if (existingCart == null)
                return null;

            var clonedCart = (ICart)((Mediachase.Commerce.Orders.Internal.IDeepCloneable)existingCart).DeepClone();
            clonedCart.CustomerId = CustomerContext.Current.CurrentContactId;
            SaveCart(clonedCart);
            return clonedCart;
}

Can it be done in a better / nicer way?

It is said here, that "IDeepCloneable Interface" "is not intended to be used directly from your code".

Br

Lasse

#208707
Edited, Oct 30, 2019 13:53
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.