user900 Posted March 31, 2021 Share Posted March 31, 2021 (edited) Hi guys, Im trying to remove some fields form the checkout page (specifically: postcode, city, address 2) First was a problem to remove the city field, I went to: International / Locations them I selected country and when I tried to remove the field "city" I couldn't, PrestaShop said the following message: "The city field (in tab Address) is required" So after some google, I found out I need to modify: classes/Address.php I commented the whole line 134 that said: 'city' => ['type' => self::TYPE_STRING, 'validate' => 'isCityName', 'required' => true, 'size' => 64], The problem persisted, and I still got the same message, so I edit the file classes/AddressFormat.php I commented the line 63 that said "city": /** @var array Default required form fields list */ public static $requireFormFieldsList = [ 'firstname', 'lastname', 'address1', // 'city', 'Country:name', ]; Now, I finally was available to remove the field. But the issue still persit. Let me explain my self: If you go to the checkout page, you can see the postal code and city field. But, when I select the country, everything looks like is supposed to look. Any idea? How can I do, so i can remove the postcode and the city field? Btw, my cache is off, but, I had cleaned my cache (in the performance page) and also I cleaned the cache on my browser. Also, I deleted this folder: /var/cache/prod/ Thanks guys I use Prestashop: 1.7.7.2 Edited March 31, 2021 by user900 (see edit history) Link to comment Share on other sites More sharing options...
NestorAcevedo Posted September 20, 2021 Share Posted September 20, 2021 (edited) On 3/31/2021 at 4:18 PM, user900 said: Hi guys, Im trying to remove some fields form the checkout page (specifically: postcode, city, address 2) First was a problem to remove the city field, I went to: International / Locations them I selected country and when I tried to remove the field "city" I couldn't, PrestaShop said the following message: "The city field (in tab Address) is required" So after some google, I found out I need to modify: classes/Address.php I commented the whole line 134 that said: 'city' => ['type' => self::TYPE_STRING, 'validate' => 'isCityName', 'required' => true, 'size' => 64], Instead of to comment the line, you can set the required value to false, the same with the state field and the country field. The only one field that is REQUIRED by force is postcode. It will be required, no matter what you do. So, you only may add some CSS rules to hide these fields. Edited September 20, 2021 by NestorAcevedo (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now