CMS Magento Mastering Development

Get error Guest checkout is disabled after ajax customer login Magento 2.3.3

I am facing the issue with “Guest checkout is disabled” error after the customer log in using Ajax call. Guest checkout is disabled due to the requirement. The below code will run on clicking by the “go to checkout” button.

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$customer = $objectManager->create('Magento\Customer\Model\Customer')->load(3121); //2 is Customer ID
$customerSession = $objectManager->create('Magento\Customer\Model\Session');

After getting ajax response I am trying to redirect on the checkout but it redirects on the checkout/cart page with “Guest checkout is disabled”.
I have also set the section file for the ajax call and update the customer section.

If anyone has to face the issue please suggest the your thoughts.

Thanks in advanced.

Leave a Reply

Your email address will not be published. Required fields are marked *