Magento Multiple Order on One Checkout

Create multiple order for every vendor based on its products in the cart during one checkout.

Posted on April 8, 2016 in Magento

It is doable quite easily with a rewrite of the checkout/type_onepage model.

In that class override the saveOrder() method as follows:

public function saveOrder() {
    $quote = $this->getQuote();

    //First build an array with the items split by vendor
    $sortedItems = array();
    foreach ($quote->getAllItems() as $item) {
        $vendor = $item->getProduct()->getVendor(); //<- whatever you need
        if(!isset($sortedItems[$vendor])) {
             $sortedItems[$vendor] = $item;

    foreach($sortedItems as $vendor => $item) {
        //Empty quote
        foreach($quote->getAllItems() as $item) {

        foreach($items as $item) {

        //Update totals for vendor

        //Delegate to parent method to place an order for each vendor
    return $this;

But be aware that in Magento a payment is associated with an invoice, and each invoice is associated with an order.

comments powered by Disqus