Plugin Contributor
Ewout
(@pomegranate)
Hi! The address is formatted by WooCommerce depending on what’s common in that country. For example, a Dutch address will be:
{company}
{name}
{address_1}
{address_2}
{postcode} {city}
{country}
While a US address will be:
{name}
{company}
{address_1}
{address_2}
{city}, {state_code} {postcode}
{country}
You can find these formats here.
Just so that you know it’s not completely random, and also not something that the PDF invoice plugin does π
If you want to change this format woocommerce wide, you could use the woocommerce_localisation_address_formats filter. (example here)
For the invoices specifically, you can do this with the Professional extension out of the box from the settings.
Hope that helps!
Ewout
Thank you, I will look into that! The only problem is that here in Norway it should be like the Dutch adress, but it seems WooCommerce is configured wrongly!
Plugin Contributor
Ewout
(@pomegranate)
Which version of WooCommerce are you using? The latest version of woocommerce uses the ‘postcode_before_city’ format for NO (just like NL). Note that even if your shop is based in Norway, it will (or should) still format a US address the US way. If this is not the case, there’s probably a plugin that changes this – it could be a plugin for custom checkout fields or other checkout related plugins.
Hope that helps!
Ewout
Could it be the WooCommerce Poor Guys Swiss Knife do you think?
Plugin Contributor
Ewout
(@pomegranate)
That’s certainly possible – it’s easy enough to find out by turning it off temporarily.
It was, but I can’t fix it in the settings. Does not work. I will check their forum.
Thanks!
Plugin Contributor
Ewout
(@pomegranate)
WooCommerce Poor Guys Swiss Knife is not supported anymore, so I would look for alternative. It’s probably using the order that you have defined in the checkout. That would be the firs thing to check (in the WCPGSK settings you can reorder the fields by dragging them).
If you want to keep the checkout order the way it is now (independent from the address in the invoice), you can unload its filters that override the WooCommerce default behavior, by adding this to your theme functions:
add_action( 'init', 'wcpdf_remove_wcpgsk_filters' );
function wcpdf_remove_wcpgsk_filters() {
global $wcpgsk;
remove_filter( 'woocommerce_order_formatted_billing_address', array($wcpgsk, 'wcpgsk_order_formatted_billing_address'), 99 );
remove_filter( 'woocommerce_order_formatted_shipping_address', array($wcpgsk, 'wcpgsk_order_formatted_shipping_address'), 99 );
}
Let me know if that helps!
Ewout
Works great, thank you incredibly much!
Plugin Contributor
Ewout
(@pomegranate)
You’re welcome – very glad to hear that π