I created the plugin for different payment methods by following this post.

It works fine, but it has an error.

When you want to change to another shipping method, if you previously had a payment method selected and this is disabled by the plugin, it's enabled and duplicated.

Also, it doesn't load correctly, since it gives an error with javascript and doesn't load the method completely.

it doesn't load correctly

error with javascript

This 2nd failure is given even if you don't select any payment method previously

If they can review it, it's appreciated

1 Answer 1


Create cashondelivery-method.js on following path


Add following code in that file

    function (Component) {
        'use strict';
        return Component.extend({
            defaults: {
                template: 'Magento_OfflinePayments/payment/cashondelivery'

            /** Returns payment method instructions */
            getInstructions: function() {

                if (typeof window.checkoutConfig.payment.instructions != 'undefined')
                    return window.checkoutConfig.payment.instructions[this.item.method];

Now run setup upgrade and content deployment command.

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.