splitting up cart and orders

Hi everyone,

I'm currently working on a drupal commerce site where I need the ability to split up the order and payment process into different segments based on which user is selling the product. It's kind of a marketplace where users can post products and receive payment from those products.

The solution I'm currently in to is to split up the order somewhere in the process, so the cart-page would show multiple carts based on the owner of the products in them.

Every cart would represent an isolated order, which the buyer pays for in whole before proceding with the next cart.

I know there are many sharp brains out there, so if someone have a better solution, a similar issue or an idea of how to solve this in code please join in here and help me.

best regards

Posted: Nov 15, 2011


Prince Manfred on November 15, 2011

This doesn't sound like the most user friendly shopping experience. Depending on how many different sellers the customer buys from, the checkout process could become tedious and deter future business. Is it not possible for you to simply track which products belong to which seller, have payment go to one centralized source, and then split the money up to where it belongs?

chester_martin on November 15, 2011

I definitely see your point. however - just the function i'm looking for is done quite successfully on etsy.com for example. For several reasons, my customer wants that exact functionality(economic, administrational and legal reasons).

for testing, I created two separate orders for the same user and put the status to "in cart". it seems that the cart can only hold one order at a time(at least out of the box), so I probably need to figure out an easier way of doing it.

A solution might be to not allow the buyer to add a product in the cart if the product is not created by the same user who created a product already in the cart.

Prince Manfred on November 15, 2011

The customer is always right (so I've been told ;) ) Here's a thought on keeping the orders separated by seller. You'd need to add a new field to orders that can hold the user id of the user who created the products (or some unique identifier that can be tied to whoever is supposed to be paid.) Upon clicking add to cart you'd have to check who created the product being added to cart and see if an order exists with that user id in the field you created. If there is one then add the product to that order. If not create a new order and populate the field you created on the order with the user id of the product.

Of course it's easier said than done. You'll need to override the add to cart process and I've never looked into how you might accomplish that. Just trying to flesh out some ideas.

chester_martin on November 16, 2011

yeah, customers...;-)

anyway, I got an idea from the stock module. I noticed they are altering the add-to-cart form and puts in an extra validation-function for the quantity. So I figure that I can only make a validation everytime a user puts a new item in the cart:

I need the seller from the item they want to put in the cart and the seller from any item in the cart.

If they don't match:

"You have items in the cart from another seller. Please check out your current cart before proceding" (something like that)

If they do match - everything is fine.

I know this sounds odd, but I think the type of items being sold in this webshop people are probably ok with this. double carts can be an extra feature later on.

Brian on November 16, 2011

Just a spontanious idea: Maybe you could do something like a pre-cart in the sense of a shopping list. The user adds his products to that list instead of the cart. Group it by seller (with views?) and do a checkout-loop with rules. Just a conceptual idea I don't know if that is feasable with the onboard functions...