Hello !
Would it be possible to have a multiple cart instance support with Commerce ?
At some points, products in a system might be handle completely differently from one to another in the checkout process (delayed payment for product of type A / immediate payment for product type B, different shipping methods...). I guess some use cases could be handled by rules at the checkout process but it can make it very complex : imagine a cart with 50$ to be paid immediately, 28$ to be paid with a delayed payment, 3 items to be shipped by this method A at 5$ rate, 4 items to be shipped by method B at 30$.... waaaaay to complicated ?
Just throwing an idea of having multiple cart instances, where product could be directed to cart 1 or 2 by rules ... it would also greatly simplify the checkout rules, and enhance/simplify the user experience of the client.
I know its probably not THE feature everybody needs, but i'd like to hear your feedbacks !
Thanks
Comments
Comment #1
rszrama commentedDrupal Commerce already supports multiple carts per user, though it only supports this for logged in users. The current cart order is simply the last created order in a cart status for the given user. This means you can create and manage multiple carts for registered users just fine - you just need to implement your own logic for determining which cart order to use when. We have a hook for getting the current user's cart order ID (defaults to the latest order as I mentioned above), and that hook can be used to make multiple cart functionality work for anonymous users and implement logic for determining which cart is the current one.
Comment #2
guy_schneerson commentedThanks @rszrama for the explanation that explains part of my issue
We have a commerce site and many of the logged in users have more then one order in "Shopping cart" and "Checkout: X" state. The last created order is used and now issues as far as we know.
What i am not clear about is what causes the multiple orders to be created in the first place.
Any help in shining a light on this behavior would be greatly appreciated.
Comment #3
rszrama commentedIt typically happens when someone logs out and logs back in, but I think we saw in another thread that it could also happen if you're losing sessions between http / https. If they get to Checkout: Payment but don't actually submit payment and come back to the site later, that would also result in a new cart order being created. Any of these ring true?
Comment #4
guy_schneerson commentedThanks @rszrama
The site doesn't use https but does use an offsite payment that is https.
I will test on logout/login and cancellation of the offsite payment to try and track it down.
Comment #5
guy_schneerson commentedok after a bit of investigation found out the following:
Log in logout didn't create any additional orders in cart/checkout state (not for me anyway).
However the following did and it is predictable case and the correct behaviour.
This happens on an offsite payment gateway but can happen on a normal payment but less likely
1) When an order goes to Checkout: Payment it disappears from the basket
2) When cancelled it goes back to Checkout: Review
However if while in “Checkout: Payment” you have another window open and add an item to the basket a new order is created.
If you then cancel the payment in the first window the first order is back with an Checkout: Review state you can even cancel the order and get two orders in Shopping basket state.
This possibly has many exiting use cases.
Fills two me like the order/cart state thing is vary robust and fills me with confidence great work @rszrama, commerce guys and anyone else that has contributed code.
If anyone else comes across any other cases that this happens please share.
Comment #6
rszrama commentedYeah, that's quite a convoluted process, eh? : P
fwiw, it's not a requirement that orders at Checkout: Payment stop being treated like carts, but it's my current recommendation. Once the user is off at the payment gateway, we want to protect the existing order from any further changes on site. I never thought about what would happen if the customer came back from the payment gateway after trying that and ending up with two checkout orders, though. Sounds like a confused customer. ^_^
Comment #7
guy_schneerson commentedUsing my new found knowledge
I created a wish list style order on realmilkcheese.com that's separate from my basket and i can complete checkout when ever I want, as long as i remember the order number (I'll need to move to the US first).
Handy feature us developers can use on Drupal Commerce site :)
Comment #8
rszrama commentedlol Nice. : P
Comment #10
sathishdevan commentedHi,
I also require the same functionality to be built through drupal commerce. Let me know, If You had found any solution for cart1 and cart2(ie Multi cart and differrent checkout for each of the cart orders).
Regards,
Sathishkumar V
Comment #11
voodootea commentedWere there any further developments in this issue? I'm also looking for a configurable multi-cart solution. Thanks
Comment #12
JamesMugford commentedI second that. This would be a great feature.
Comment #13
danzVP06 commentedAre there any updates on this? #10 feature is very useful (because we also need this). If it's already developed, is there any documentation?
Thank you!!
Comment #14
spacetaxi commentedI've created a module, Commerce Cart Multiple, that provides for management of multiple carts. Currently in sandbox here: https://www.drupal.org/sandbox/spacetaxi/2702951.
Comment #15
mhentry commentedSorry for opening this issue, Are there any updates on this? #10 feature ?? I have a need where different product type required different shopping cart view. Please help me.
Comment #16
danzVP06 commented@mhentry maybe you can try the module that was created by spacetaxi? Commerce Cart Multiple
Comment #17
mhentry commented@danzVP06 Thank you I will check the module