Gotcha ... wanted to be sure we were on the same page ...
Before going through a lot of work ... let's peek at what is really broken ...
1 check the table:
address_format
and check the address_format_id that they are setup right ...
2 check the table:
countries
and check the address_format_id are setup right ...
3 if both tables:
address_format
countries
are using the correct address_format_id ... then let's check the next stage ...
4 check the table:
address_book
and check the records for the Customer based on the customers_id to see what the field entry_country_id they are setup for ...
4 check the table:
orders
for the 3 fields:
customers_address_format_id
delivery_address_format_id
billing_address_format_id
Based on all of these checks of the database ... where is the relationship between the address_format_id and the orders breaking down?
If the only issue is that you have countries that need to be fixed on the address_format_id then you can fix the data ...
Example: countries are setup to use address_format_id 6 and it does not exist or should really be set to 1 ...
This means all address_format_id that are set to 6 and should be 1 can be fixed and then the orders can be fixed for the 3 fields as well ...
Are you following where I am going with this? :smile:
If you cannot