Magento 2 admin recreate cart

Magento 2 admin recreate cart

To restore quote or magento 2 admin recreate cart pro-grammatically we need to use admin session model, frontend magento checkout model will not be useful here. The sample code was given below,


namespace Yournamespace\Yourmodulename\Model\Adminhtml\Order;

class RecreateOrder
    public function __construct(
        \Magento\Backend\Model\Session\Quote $adminsessionquote,
        \Magento\Sales\Model\AdminOrder\Create $adminordercreate
    ) {
        $this->adminsessionquote = $adminsessionquote;
        $this->adminordercreate = $adminordercreate;

    public function reactivateAdminQuoteForOrder($mageOrder)

        $session = $this->adminsessionquote;


In custom model file use magento admin session and set the following above attributes, which will recreate the existing quote again in admin order.

No Comments yet, your thoughts are most welcome