How do I disable guest checkout for recurring product in Magento. Its very strange that magento allows Guest Checkout for recurring products and it doesn't work.
1 Answer
You can add an observer on this event checkout_allow_guest
that goes something like this:
function checkAllowGuest($observer){
$quote = $observer->getEvent()->getQuote();
$result = $observer->getEvent()->getResult();
foreach ($quote->getAllItems() as $item){
if ($item->getProduct()->getIsRecurring()){//check if the product is recurring. Condition may be diffrent.
$result->setIsAllowed(false); //don't allow checkout
break;
}
}
}
-
How can I restrict guest user to purchase certain products in checkout. I have tried above solution and set if condition with product name but its not working.. Dec 5, 2018 at 7:11