AbanteCart Community

Shopping Cart Operations => Support => General Support => Topic started by: Patricio Guaman on June 29, 2020, 07:25:49 PM

Title: Change postcode to optional field
Post by: Patricio Guaman on June 29, 2020, 07:25:49 PM
Hi, I am using Abantecart but I have the problem we dont use postal code, so I wonder if is possible change postcode from mandatory to optional field? or maybe another alternative to permit users enter the orders without the need to enter postcode.

Thanks,
Title: Re: Change postcode to optional field
Post by: dvagner on June 30, 2020, 06:02:19 AM
Hi, you can change validation behavior via Hooks Model AccountAddress, method validateAddressData
just unset $this->error['postcode']
or set default value for postcode.
Title: Re: Change postcode to optional field
Post by: Patricio Guaman on June 30, 2020, 11:00:09 AM
Thanks for the answer, I am a little confused about hooks, can you explain more how can I unset the error.

BTW, I tried to comment all this command in all the files I found $this->error['postcode'] but it is still mandatory.

if ((mb_strlen($data['postcode']) < 3) || (mb_strlen($data['postcode']) > 128)) {
     ////$this->error['postcode'] = $this->language->get('error_postcode');   
 }

See in the attached pic where is the field appearing.

Thanks!