I have a certain condition that if I have only a certain product selected then only the Email Address
should be required and all other field like firstname
, lastname
etc will be optional and this field should be hidden. Now I managed to hide this field when that product condition was satisfied but I don't know what to change the validation of the shipping address field. It always requires the other field like the firstname, lastname, address and etc... how can we make it optional when we arrive or loads the shipping page?
So basically I added the shouldDisplayAddress
in the shipping.js
shouldDisplayAddress: function()
{
if (quote_items.length == 1) {
return false;
}
return true;
},
How do I make the validation for the shipping address changed? specially when I click the next button to view the Billing Address step. So I just want to dynamically change the validation.
Update: So I found something similiar like this but I don't know how to make the other field optional except the email address