i have a big problem in magento 2.1.7 when user try to place order and click on Place Order button.. the loader spinner not stop loading and not redirect user to the success page and in the backend the order number is missing ! could you please help me to remove spinner after press on Place order button? or any other solutions? i use One Page Checkout but the same problem in regular checkout. another problem (lot of orders are missing in database and in backend) Thank you
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 (\Exception $e) {
//var_dump($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 (\Exception $e) {
//var_dump($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.
-
I have tried this answer. But still, I didn't get any console error or error log.– AgnesCommented Aug 9, 2018 at 12:58