Woocommerce input field not required if option selected

I have a WordPress site running Woocommerce and I setup a dropdown on the checkout page with 3 options for shipping choices. If they choose the first two options, two required fields show up for Carrier and Carrier Account #. For the third option I can hide these fields but I cannot seem to make these fields NOT required.

So, is there a way to make the Carrier and Carrier Account # fields NOT required if Prepay and Add shipping choice is selected?

http://mindcloak.com/escatech/checkout/

jQuery(function ($) {
$(“#additional_Shipping_Method”).change(function() {
var val = $(this).val();

if (val === “third-party”) {
$(“#additional_Carrier_Name_field”).show();
$(“#additional_Carrier_Account_Number_field”).show();
}
else if (val === “collect”) {
$(“#additional_Carrier_Name_field”).show();
$(“#additional_Carrier_Account_Number_field”).show();
}
else if (val === “prepay-add-will-advise-via-email”) {
$(“#additional_Carrier_Name_field”).hide();
$(“#additional_Carrier_Account_Number_field”).hide();

} else {

}
});
});

Read more here:: Woocommerce input field not required if option selected

Leave a Reply

Your email address will not be published. Required fields are marked *