I have created a new shipping method module. I have to enable this method by the user-selected state. If the state of the selection is Gauteng I need this method to enabled or show. I have tried it using js in this file


My code below.

if (shippingAddress) {
    isSelected = shippingAddress.getKey() == this.address().getKey(); //eslint-disable-line eqeqeq
    if (shippingAddress.getKey() == this.address().getKey()) {
        // if(this.address().countryId == 'ZA')       
        // {      
        if (this.address().region != 'gauteng') {
            console.log(this.address().region, 'city');
            let tables = document.getElementById("table-checkout-shipping-method");
            let trs = document.getElementsByTagName("tr");
            $('.table-checkout-shipping-method tbody tr:nth-child(1)').css("display", "none");

            // }     


The console.log is working under the if statement but the jquery style function is not working.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.