attribute
Programmatically Assign Attribute to All Attribute Sets in Magento 2
I will put here the way to add an attribute group then assign an attribute into all attribute set with this group, please note I am using the dirty way to add it so you will need to follow the Dependency injection in your code to have the same result
Make the Tax ID mandatory in the checkout page
The easiest way to make the tax/vat id mandatory in the checkout page is to change the is_required in the eav_attribute table
you can use this Query to change the value from 0 => 1
UPDATE `eav_attribute` SET `is_required` = '1' WHERE `eav_attribute`.`attribute_code` = 'vat_id';
or you can use this code when you want to use a custom extesnion
$installer->updateAttribute('customer_address', 'vat_id', 'is_required', true);