0

I need refresh PaymentMethod when GrandTotal is Rs.0?

I have added my js below.

    define(
                [
                    'jquery',   
                    'mage/url',
                    'Magento_Checkout/js/action/get-totals',
                    'Magento_Checkout/js/model/full-screen-loader',
                    'Magento_Checkout/js/action/get-payment-information',
                ],
                function (
                        $,
                        urlBuilder,
                        getTotalsAction,
                        fullScreenLoader,
                        getPaymentInformationAction
                        ) {
                    'use strict';

                    return function (isLoading, newValue) {
                        if (newValue) {
                            var use_wallet = 1;
                        } else {
                            var use_wallet = 0;
                        }

                        var serviceUrl = urlBuilder.build('wallet/checkout/totals');
                        jQuery.ajax({
                            url: serviceUrl,
                            type: "POST",
                            data: {use_wallet: use_wallet},
                            success: function (response) {

                                if (response) {
                                    var deferred = $.Deferred();
                                    isLoading(false);
                                    getTotalsAction([], deferred);



getPaymentInformationAction().done(function () {
    fullScreenLoader.stopLoader();
    return true
});
                                }
                            },
                            error: function (error) {
                                isLoading(false);
                            }
                        });
                    }
                }
        );
0

You can reload payment method by using below JS code

define([
    'Magento_Checkout/js/action/get-payment-information'
]



getPaymentInformationAction().done(function () {
    fullScreenLoader.stopLoader();
    return true
});
10
  • I got this error.. Uncaught TypeError: getPaymentInformationAction(...).done is not a function at Object.success (totals.js:55) at fire (jquery.js:3232) at Object.fireWith [as resolveWith] (jquery.js:3362) at done (jquery.js:9840) at XMLHttpRequest.callback (jquery.js:10311) – Ramanathan Mar 22 '18 at 7:30
  • Hi @sureshchikani, Now i have added one checkbox under payment method for wallet amount, when i click my custom checkbox my wallet amount updated, But how to refresh payment method? – Ramanathan Mar 22 '18 at 7:33
  • show your JS code – Suresh Chikani Mar 22 '18 at 7:34
  • I have added my js above. – Ramanathan Mar 22 '18 at 7:39
  • I see your question magento.stackexchange.com/questions/200138/… But u have solved it? – Ramanathan Mar 22 '18 at 7:41

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.