0

I would like to change the default error message when a transaction fails on the checkout page. right now it just says system error. this is too vague and I need to change this as customers are complaining. does anyone know where I can look to make this change in magento 2.1.7

1
  • you need to use plugin & override module-checkout/Model/PaymentInformationManagement.php
    – Yogesh
    Nov 9, 2017 at 5:01

1 Answer 1

0

Override this method and update the text as customers needed.

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;
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.