Normally you always ship to country Y. Except for product X. This is either too heavy, too bulky or cannot be sent to country Y for legal reasons.
Each product has a text field in the admin area in which you can enter the country abbreviations to which the product may NOT be sold.
In the checkout - delivery address - the delivery address entered by the customer is checked.
If there is a product in the shopping cart that is prohibited for this country, there is an error message and the customer cannot continue.
All modules in the legal area were programmed at the customer's request. Please ask your lawyer whether they are legally required. We cannot provide any information on this.