/** * Get checkout method * * @return string */ public function getCheckoutMethod() { if ($this->getCustomerSession()->isLoggedIn()) { return \Magento\Checkout\Model\Type\Onepage::METHOD_CUSTOMER; } if (!$this->_quote->getCheckoutMethod()) { if ($this->_checkoutData->isAllowedGuestCheckout($this->_quote)) { $this->_quote->setCheckoutMethod(\Magento\Checkout\Model\Type\Onepage::METHOD_GUEST); } else { $this->_quote->setCheckoutMethod(\Magento\Checkout\Model\Type\Onepage::METHOD_REGISTER); } } return $this->_quote->getCheckoutMethod(); }
/** * Get checkout method * * @param Quote $quote * @return string */ private function getCheckoutMethod(Quote $quote) { if ($this->customerSession->isLoggedIn()) { return Onepage::METHOD_CUSTOMER; } if (!$quote->getCheckoutMethod()) { if ($this->checkoutHelper->isAllowedGuestCheckout($quote)) { $quote->setCheckoutMethod(Onepage::METHOD_GUEST); } else { $quote->setCheckoutMethod(Onepage::METHOD_REGISTER); } } return $quote->getCheckoutMethod(); }