2

I have added one field for extra charges, depends on radio button selection in checkout page, its working with page refresh, but I want it to get data without page refresh.

1 Answer 1

2

I was solved that issue using below code.

jQuery( "#radio-button-id" ).change(function() {
    var id = this.id;
    require([
        'jquery',
        'Magento_Checkout/js/action/get-totals'
        ], function ($, getTotalsAction) {
        "use strict";

        $.ajax({
            method: "post",
            url: "<?php echo $baseUrl; ?>action/", //your ajax Url
            data: { id: id},
            dataType: "json",
            success: function (data) {
                var deferred = $.Deferred();
                getTotalsAction([], deferred);
            }
        });
    });
});

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.