1

I want to set the default payment Credit Card option on the checkout page.

enter image description here

Please help.

4

1 Answer 1

1

The Magento built-in payment methods don't support the ability to select a default payment.

But, if you have custom payment method and if your custom js component extends Magento\Checkout\view\frontend\web\js\view\payment\default.js, you can use selectPaymentMethod method to set your payment as the default one.

define(['Magento_Checkout/js/view/payment/default'], function(Component) {
    initObservable: function () {
        this._super();
        this.selectPaymentMethod();
        ...
    }
});

If your payment js component has lazy initialization, you should call selectPaymentMethod on some onReady event.

1
  • Please let me know we need to create a new js file. Feb 28, 2020 at 10:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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