0

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

0

Create cashondelivery-method.js on following path

app/design/frontend/vendor/theme/Magento_OfflinePayments/web/js/view/payment/method-renderer

Add following code in that file

define(
    [
        'Magento_Checkout/js/view/payment/default'
    ],
    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, privacy policy and cookie policy

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