Jump to content

How to adapt APE field for Finnish bussiness-id format in Prestashop 1.7.8.11?


Arifdemircan

Recommended Posts

Hi everyone,

I'm working on adapting the APE field (Y-tunnus) in Prestashop 1.7.8.11 to match the Finnish business ID format: 1607767-8 (7 digits + hyphen + 1 digit). Despite multiple attempts, Prestashop keeps rejecting valid entries with the error: “This field is invalid.”

Here’s what I’ve tried so far:

Removed the validate rule from Customer.php ('ape' => ['type' => self::TYPE_STRING])

Updated Validate::isApe() to accept hyphenated numbers

Cleared all caches (dev/prod, browser, admin)

Checked CustomerFormatter.php and Symfony form constraints

Tried using isGenericName and even removed validation entirely

Created a custom module (bussinessid) using hookActionCustomerFormBuilderModifier to override constraints:

Removed default Type constraint

Added custom Regex to allow 1607767-8 or empty

Updated label to “Bussiness ID”

Ensured the field is optional (required => false)

Added B2B check (Configuration::get('PS_B2B_ENABLE')) so the field only appears for company customers

Despite all this, Prestashop still throws the same validation error when entering a valid Y-tunnus like 1607767-8.

Has anyone successfully implemented Finnish Y-tunnus validation in Prestashop? Is there a hidden override or constraint I might be missing?

 

I'm working with Prestashop 1.7.8.11 and I need help customizing the APE field in the Customers > Create a Customer section.

In Finland, the business ID (Y-tunnus) format is typically 1607767-8 — 7 digits followed by a hyphen and 1 digit. I would like to either:

Adapt the APE field to accept this Finnish format OR

Completely remove the APE field and keep only the SIRET field for company registration

I’ve tried modifying the validation rules and even created a custom module to override constraints, but the system still throws “This field is invalid” when entering a valid Y-tunnus.

Is there a current and reliable method to either:

Make the APE field accept Finnish Y-tunnus format

Or disable it entirely and rely on SIRET only?

Any guidance or updated best practices would be greatly appreciated.

Any help or insight would be greatly appreciated!

Thanks in advance,

 

 

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...