Is there an event for the checkout when you choose the payment method?

So when the site where you choose the payment method is called I want the event to trigger.


require 'Magento_Checkout/js/model/quote';


quote.paymentMethod.subscribe(function(){console.log('test')}, null, 'change');

You will find plenty of observe there

var billingAddress = ko.observable(null);
var shippingAddress = ko.observable(null);
var shippingMethod = ko.observable(null);
var paymentMethod = ko.observable(null);
var totals = ko.observable(totalsData);
var collectedTotals = ko.observable({})

if you want to check the payment method inside a function, you can use first argument, like:

quote.paymentMethod.subscribe(function(method){console.log(method);}, null, 'change')
| improve this answer | |
  • in which file ? – k33n Jun 7 '18 at 9:32
  • create a custom module – Rahul Singh Jun 7 '18 at 9:49

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.