I have created a store for my Website, that works fine but checkout page at store is not working while it is working fine at main website. If we checkout a product through store only loader is running and page is not getting loaded.
Help will be appreciated.
-
It would be helpful if you included screenshots of what it looks like. Also have you checked logs made sure your cache is cleared. Fixed any permissions issue you might have. recompiled your generated files.– danmentzerFeb 15, 2018 at 13:42
1 Answer
To know the exact reason why it is happen, please open below file:
vendor/magento/module-checkout/Model/PaymentInformationManagement.php
then comment out the try, catch and put code to place order directly as below:
Replace below function
public function savePaymentInformationAndPlaceOrder(
$cartId,
\Magento\Quote\Api\Data\PaymentInterface $paymentMethod,
\Magento\Quote\Api\Data\AddressInterface $billingAddress = null
) {
$this->savePaymentInformation($cartId, $paymentMethod, $billingAddress);
try {
$orderId = $this->cartManagement->placeOrder($cartId);
} catch (\Magento\Framework\Exception\LocalizedException $e) {
throw new CouldNotSaveException(
__($e->getMessage()),
$e
);
} catch (\Exception $e) {
$this->getLogger()->critical($e);
throw new CouldNotSaveException(
__('An error occurred on the server. Please try to place the order again.'),
$e
);
}
return $orderId;
}
To
public function savePaymentInformationAndPlaceOrder(
$cartId,
\Magento\Quote\Api\Data\PaymentInterface $paymentMethod,
\Magento\Quote\Api\Data\AddressInterface $billingAddress = null
) {
$this->savePaymentInformation($cartId, $paymentMethod, $billingAddress);
//try {
$orderId = $this->cartManagement->placeOrder($cartId);
/*} catch (\Magento\Framework\Exception\LocalizedException $e) {
throw new CouldNotSaveException(
__($e->getMessage()),
$e
);
} catch (\Exception $e) {
$this->getLogger()->critical($e);
throw new CouldNotSaveException(
__('An error occurred on the server. Please try to place the order again.'),
$e
);
}*/
return $orderId;
}
Now, try to place order again. You will be able to see the details error in log file or may be in console.