ok so i find the solution for prestashop 8.2 for anyone who needs it.
first of all make sure both company and VAT number are unchecked in back office (this code will do it just for a specific store)
In controllers/front/RegistrationController.php
change this
public function initContent()
{
$register_form = $this
->makeCustomerForm()
->setGuestAllowed(false)
->fillWith(Tools::getAllValues());
// If registration form was submitted
if (Tools::isSubmit('submitCreate')) {
$hookResult = array_reduce(
Hook::exec('actionSubmitAccountBefore', [], null, true),
function ($carry, $item) {
return $carry && $item;
},
true
);
// If no problem occured in the hook, let's get the user redirected
if ($hookResult && $register_form->submit() && !$this->ajax) {
// First option - redirect the customer to desired URL specified in 'back' parameter
// Before that, we need to check if 'back' is legit URL that is on OUR domain, with the right protocol
$back = rawurldecode(Tools::getValue('back'));
if (Tools::urlBelongsToShop($back)) {
return $this->redirectWithNotifications($back);
}
// Second option - we will redirect him to authRedirection if set
if ($this->authRedirection) {
return $this->redirectWithNotifications($this->authRedirection);
}
// Third option - we will redirect him to home URL
return $this->redirectWithNotifications(__PS_BASE_URI__);
}
}
$this->context->smarty->assign([
'register_form' => $register_form->getProxy(),
'hook_create_account_top' => Hook::exec('displayCustomerAccountFormTop'),
]);
$this->setTemplate('customer/registration');
parent::initContent();
}
by this but make sure you add the id of your store correctly
public function initContent()
{
$register_form = $this
->makeCustomerForm()
->setGuestAllowed(false)
->fillWith(Tools::getAllValues());
$id_shop = $this->context->shop->id;
// If registration form was submitted
if (Tools::isSubmit('submitCreate')) {
// ✅ Custom validation for shop ID 3
if ($id_shop == 3) {
$company = Tools::getValue('company');
$vat = Tools::getValue('vat_number'); // PrestaShop uses "vat_number" internally
if (empty($company)) {
$register_form->getField('company')->addError(
$this->trans('Company is required.', [], 'Shop.Notifications.Error')
);
}
if (empty($vat)) {
$register_form->getField('vat_number')->addError(
$this->trans('VAT number is required.', [], 'Shop.Notifications.Error')
);
}
}
// Keep the hook and original logic
$hookResult = array_reduce(
Hook::exec('actionSubmitAccountBefore', [], null, true),
function ($carry, $item) {
return $carry && $item;
},
true
);
if ($hookResult && $register_form->submit() && !$this->ajax) {
$back = rawurldecode(Tools::getValue('back'));
if (Tools::urlBelongsToShop($back)) {
return $this->redirectWithNotifications($back);
}
if ($this->authRedirection) {
return $this->redirectWithNotifications($this->authRedirection);
}
return $this->redirectWithNotifications(__PS_BASE_URI__);
}
}
$this->context->smarty->assign([
'register_form' => $register_form->getProxy(),
'hook_create_account_top' => Hook::exec('displayCustomerAccountFormTop'),
]);
$this->setTemplate('customer/registration');
parent::initContent();
}
😁😁😁😁