With the address data, I sometimes get the error message: [error formatting address]
This is shown to me in the e-mail AND in the Modx Manager in Commerce.
But not for all orders. What could be the reason for this?
With the address data, I sometimes get the error message: [error formatting address]
This is shown to me in the e-mail AND in the Modx Manager in Commerce.
But not for all orders. What could be the reason for this?
The reason should be detailed in the MODX error log.
Most commonly, the address has no country set, which means the address formatter can’t determine the rules for formatting, as those are country-specific.
Make sure you have a country field in the address forms (even if it’s hidden and set to a hard coded value) and also double check the address validation module is requiring the country field.
The country is default: Switzerland (CH). The country-select-field is hidden via css, because the customer only wants to deliver to Switzerland.
< option value=“CH” selected=“selected”>Schweiz</ option>
Error-Log:
Exception InvalidArgumentException with message Missing required property country_code. parsing address: {“id”:36,“class_key”:"…
So the country has already been selected. It is not quite clear to me now what exactly I am supposed to do, since the country is already selected.
Perhaps the way it’s hidden with CSS, rather than a <input type="hidden">
causes the country to not get submitted?
Did you check the address validation module is making sure the country field is there? Should be there by default, but perhaps that’s not enabled or removed as you only ship to one country.
Repeat customers might be using addresses stored on their profile that lack the country, however the validation module ought to catch that and show errors if it’s set to check the country.
I’ve hardcoded it now and see if it works. Now the country is always pre-selected and only the country is available for selection.
I’m going to test this now. This is probably the solution. Thank you for your support and have a nice weekend. Greetings