1

I want to move an inactive quote to the checkout page.

A customer searches for products and adds them in the cart but doesn't want to checkout on that day.

Now on next day he wants to order some products which are not present in the current cart. He also wants to keep all the current product in the cart.

My solution to this is, the customer will make the current cart(quote) to inactive (By clicking some button on the cart page). This quote will be visible in my account section.

I need an ability to move this inactive cart to an active cart. That is when the customer wants to continue to do checkout of this quote.

6
  • Explain in some more detail, what you are looking for? Commented Feb 26, 2020 at 5:24
  • @DhirenVasoya I have edited the question please look into this. Thank you Commented Feb 26, 2020 at 5:38
  • 1
    please check this one : magecomp.com/magento-2-email-quote-pro.html Commented Feb 26, 2020 at 5:42
  • I don't want to buy the plugin. I want to build it. Commented Feb 26, 2020 at 5:45
  • 1
    move cart to wishlist Commented Mar 12, 2020 at 11:14

1 Answer 1

3
+50

Assume the

$activeQuoteId is the id of current activeQuote

$inActiveQuoteId is the id of current inactiveQuote

And 2 quotes must belong to customer,

You should active which quote do you want for customer, then set to current checkout session.

 /** @var $activeQuote \Magento\Quote\Model\Quote */ $activeQuote = $this->quoteRepository->get($activeQuoteId); $activeQuote->setIsActive(0); $this->quoteRepository->save($activeQuote); /** @var $inActiveQuote \Magento\Quote\Model\Quote */ $inActiveQuote = $this->quoteRepository->get($inActiveQuoteId); $inActiveQuote->setIsActive(1)->setReservedOrderId(null); $this->quoteRepository->save($inActiveQuote); /** @var $session \Magento\Checkout\Model\Session */ $session->replaceQuote($inActiveQuote); 

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.