fredol Posted October 16 Share Posted October 16 I did these setting, yet "company" is not required. Why? Thanks Link to comment Share on other sites More sharing options...
endriu107 Posted October 16 Share Posted October 16 This option you set is for address not for customer create account, that why it is still optional. Link to comment Share on other sites More sharing options...
WebDesk Solution Posted November 5 Share Posted November 5 @fredol We have provided a solution to make the company field required. Please follow the steps below: Step 1: Create a Clean Override FilePath: Ensure your override file is located at override/classes/form/CustomerFormatter.php. Step 2: Copy the code below into the file, ensuring the correct PHP syntax: <?php // File: override/classes/form/CustomerFormatter.php class CustomerFormatter extends CustomerFormatterCore { public function getFormat() { // Get the default format defined by the core $format = parent::getFormat(); // Loop through each FormField object in the format foreach ($format as $field) { // Check if this FormField is the 'company' field if ($field->getName() === 'company') { // Set the company field as required $field->setRequired(true); } } return $format; } } ?> Step 3: In your PrestaShop admin panel, go to Advanced Parameters > Performance and click Clear Cache.Step 4: Visit the registration page on the front end to verify. Please review the screenshot for reference. We hope this solution works for you! 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