CodeExplorer getCheckVatIdPattern example
if (!
$countryCompanyTaxFree || !
$customer || !
$customer->
getCompany()) { return false;
} $vatPattern =
$shippingLocationCountry->
getVatIdPattern();
$vatIds =
array_filter($customer->
getVatIds() ??
[]);
if (empty($vatIds)) { return false;
} if (!
empty($vatPattern) &&
$shippingLocationCountry->
getCheckVatIdPattern()) { $regex = '/^' .
$vatPattern . '$/i';
foreach ($vatIds as $vatId) { if (!
preg_match($regex,
$vatId)) { return false;
} } } return true;
}}