cancel
Showing results for 
Search instead for 
Did you mean: 

Update Postal Code

SOLVED

Update Postal Code

Hi.

 

I would like to change post code on cart (in Summary section) as soon as a client input their postcode in a popup field.

 

 $("#popuppostcode").on('change', function () {
  // Update Zip/Postal Code in Summery section on Cart
    });

I have added a code in customer-data.js

Would you give me the suggestions for it?

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Update Postal Code

    $("#popuppostcode").on('change', function (event) {
        var postcode = $(this).val();
        $('input[name="postcode"]').val(postcode);
    });

Sorry I did it myself.

View solution in original post

2 REPLIES 2

Re: Update Postal Code

    $("#popuppostcode").on('change', function (event) {
        var postcode = $(this).val();
        $('input[name="postcode"]').val(postcode);
    });

Sorry I did it myself.

Re: Update Postal Code

Hello @tvgarden

 

 $('input[name="postcode"]').val(postcode);

// after that, you need to fire the relative event to reload sidebar.

 $('input[name="postcode"]').trigger('change');

Hope it will help you.


Problem solved? Click Kudos & Accept as Solution!
Sunil Patel
Magento 2 Certified Professional Developer & Frontend Developer