1

M2.3.3: We have a situation where all quotes remain active (i.e. is_active=1). That means they're never cleared by cron as that only clears inactive quotes.

We now have ~186k quotes in the database, going back to when the site was first setup. 185k have no customer id; around 900 have a customer id. As the store is B2B and only open to logged in customers (no guests), how can we end up with the majority of quotes having no customer (customer_id=NULL)? Only thing that I can think is Magento is creating a quote for every single visitor, before they logon. Assume the customer gets another quote when they logon, leaving these "guest" quotes active so they're never cleared. None are persistent (that's off).

Seems to me the quote clean-up routine is not fit for purpose.

However, clearly there's something seriously awry with how quotes are converted to orders. Appears that in our checkout process, quotes generating orders are never being set inactive. I've tried to trace how the quote gets set inactive during the order flow, but nothing jumps out in the code to suggest where this should happen.

Does anyone know what part of the order process (i.e. code) is supposed to set the quote that generated it to inactive?

Thanks

1
  • Some further info on "null" quotes. Cannot find any logic here. Sometimes just visiting the site creates a new null quote, other times not. We use an uptime monitor. Sometimes that get's a null quote every time it polls, other times new null quotes only appear sporadically. I'm sure there must be some logic at play here, but seems entirely random! – Adam Lavery Feb 19 at 12:25
1

Having located the override in our setup (in a checkout module that adds custom fields), I was able to confirm that normally processed quotes are in fact being set inactive when converted to orders.

The fault seems to be two-fold:

  1. Magento is sometimes creating "null" quotes for visitors. Can't fathom why it sometimes does and sometimes doesn't, but not really interested why. Why doesn't it create quotes on first add-to-cart instead of (sometimes) when a visitor arrives? i.e. when a visitor/customer actually starts a purchase instead of on the off-chance they might.

  2. The quote clean-up process simply doesn't work. All these "null" quotes are never dealt with because they are forever active and the housekeeping only looks at inactive quotes. Even inactive quotes are not reliably cleaned as well as old genuine unconverted quotes being left behind forever. The clean-up logic needs an overhaul.

Here we go, will now have to prove the case to Adobe on a vanilla install then try to fathom what all the bot-driven posts/status flags actually mean in terms of delivering a fix!!

0

Quotes are setted as inactive in \Magento\Payment\Model\QuoteManagement::submitQuote:198

        try {
        $order = $this->orderManagement->place($order);
        $quote->setIsActive(false);
        $this->eventManager->dispatch(
            'sales_model_service_quote_submit_success',
            [
                'order' => $order,
                'quote' => $quote
            ]
        );
        $this->quoteRepository->save($quote);
    } catch (Exception $e) {
        $this->rollbackAddresses($quote, $order, $e);
        throw $e;
    }

I believe some of your custom payment methods are working not fine.

1
  • Thanks for the pointer, but I think you mean \Magento\Quote\Model\QuoteManagement::submitQuote. There is no such class under Payment. However, helped me locate this so thanks. – Adam Lavery Feb 23 at 9:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.