In Magento 2 I try to track shipping method change in JS.

For exemple when pickup relay is selected I need to display a specific message on frontend.

Do you how can I do this ?

1 Answer 1


1. Register mixin


let config = {
    config: {
        mixins: {
            'Magento_Checkout/js/action/select-shipping-method': {
                'Acme_StackExchange/js/action/select-shipping-method-mixin': true

2. Create mixin


], function (wrapper) {
    'use strict';

    return function (selectShippingMethod) {
        return wrapper.wrap(selectShippingMethod, function (_super, shippingMethod) {
            if (shippingMethod) {
                // your logic before shippingMethod set to quote
            if (shippingMethod) {
                // your logic after shippingMethod set to quote

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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