Hi @jpnl,
I couldn’t leave this alone. ??
Here is a code snippet you can put in your child theme’s functions.php to add the store address placeholders (or others) to the footer text in WooCommerce > Settings > Emails:
add_action( 'woocommerce_email_footer_text', 'addWCFooterPlaceholders', 10, 1 );
function addWCFooterPlaceholders($footer_text){
/*
This function adds the following placeholders to the WooCommerce
footer text:
* {store_address}
* {store_address_2}
* {store_city}
* {store_postcode}
* {store_country}
* {store_state}
*/
// The main address pieces:
$store_address = get_option('woocommerce_store_address');
$store_address_2 = get_option('woocommerce_store_address_2');
$store_city = get_option('woocommerce_store_city');
$store_postcode = get_option('woocommerce_store_postcode');
// The country/state
$store_raw_country = get_option('woocommerce_default_country');
// Split the country/state
$split_country = explode(":", $store_raw_country);
// Country and state separated:
$store_country = $split_country[0];
$store_state = $split_country[1];
$search = array(
'{store_address}',
'{store_address_2}',
'{store_city}',
'{store_postcode}',
'{store_country}',
'{store_state}'
);
$replace = array(
$store_address,
$store_address_2,
$store_city,
$store_postcode,
$store_country,
$store_state
);
$footer_text = str_replace($search, $replace, $footer_text);
return $footer_text;
}
It won’t add the available placeholders to the tooltip for the footer text, so I put them in as a comment in the code snippet.
Once you’ve added the code snippet to your child theme’s functions.php, all you have to do is add the placeholders you want to use to the footer text box on the WooCommerce Email Settings page. I’ve tested it in WP 5.9.2 and WooCommerce 6.3.1, and it works with no errors.