Getting occasional page can't be found errors in Joomla 4 and VM 3.8.9 10560
The cause seems to be be passing messages via the redirect function which is deprecated.
However enqueueMessage() can be used instead.
in cart.php change
//$app->redirect(JRoute::_('index.php?option=com_virtuemart&view=cart&task='.$task,$this->useXHTML,$this->useSSL), $msg);
$app->enqueueMessage($msg);
$app->redirect(JRoute::_('index.php?option=com_virtuemart&view=cart&task='.$task,$this->useXHTML,$this->useSSL));
//$app->redirect(JRoute::_($relUrl,$this->useXHTML,$this->useSSL), $redirectMsg);
$app->enqueueMessage($redirectMsg);
$app->redirect(JRoute::_($relUrl,$this->useXHTML,$this->useSSL));
//$app->redirect(JRoute::_('index.php?option=com_virtuemart&view=cart'.$layoutName, FALSE), vmText::_('COM_VIRTUEMART_CART_CHECKOUT_DONE_CONFIRM_ORDER'));
$app->enqueueMessage(vmText::_('COM_VIRTUEMART_CART_CHECKOUT_DONE_CONFIRM_ORDER'));
$app->redirect(JRoute::_('index.php?option=com_virtuemart&view=cart'.$layoutName, FALSE));
// $app->redirect(JRoute::_('index.php?option=com_virtuemart&view=cart'.$this->getLayoutUrlString(), FALSE), vmText::_('COM_VIRTUEMART_CART_CHECKOUT_DATA_CHANGED'));
$app->enqueueMessage(vmText::_('COM_VIRTUEMART_CART_CHECKOUT_DATA_CHANGED'));
$app->redirect(JRoute::_('index.php?option=com_virtuemart&view=cart'.$this->getLayoutUrlString(), FALSE));
// $app->redirect(JRoute::_('index.php?option=com_virtuemart&view=cart'.$this->getLayoutUrlString(), FALSE), vmText::_('COM_VIRTUEMART_CART_CHECKOUT_DATA_NOT_VALID'));
$app->enqueueMessage(vmText::_('COM_VIRTUEMART_CART_CHECKOUT_DATA_NOT_VALID'));
$app->redirect(JRoute::_('index.php?option=com_virtuemart&view=cart'.$this->getLayoutUrlString(), FALSE));
edited to add other redirects in cart.php . Enqueue message before redirect.
These are the redirects causing the most common problems during checkout, but there are other similar redirects used elsewhere.