Titel (z. B. “Professor”) als Namensteil in PDF-Rechnung

[ad_1]

Hallo,

ich brauche im Checkout ein Extra-Feld “Titel”. Das kann z. B. ein akademischer Grad wie “Prof. Dr.” oder ein Adelstitel sein.
Der Titel soll in allen weiteren Schritten Namensbestandteil sein. Es soll also z. B. “Prof. Dr. Hans Mustermann” in der Rechnung stehen.

Habe das Feld “billing_nobility” mit dem Plugin “Checkout Field Editor for WooCommerce” angelegt und das wird auch im Checkout und in den Mails verwendet:

add_filter( 'woocommerce_order_formatted_billing_address' , 'th56t_woo_custom_order_formatted_billing_address', 10, 2 );
function th56t_woo_custom_order_formatted_billing_address( $address, $WC_Order ) {
     
	$address['billing_nobility'] = get_post_meta( $WC_Order->get_id(), 'billing_nobility', true );
    return $address;

}

add_filter( 'woocommerce_formatted_address_replacements', function( $replacements, $args ){
	$replacements['{billing_nobility}'] = isset($args['billing_nobility']) ? $args['billing_nobility'] : (WC()->checkout->get_posted_address_data( "nobility", "billing" ) ? WC()->checkout->get_posted_address_data( "nobility", "billing" ) : '');
    return $replacements;

}, 10, 2 );

add_filter( 'woocommerce_localisation_address_formats' , 'woo_includes_address_formats', 10, 1);
function woo_includes_address_formats($address_formats) {
	
    $address_formats['default'] = "{billing_nobility}\n{first_name} {last_name}\n{company}\n{address_1}\n{address_2}\n{postcode} {city}\n{country}";
	$address_formats['DE']      = "{billing_nobility}\n{first_name} {last_name}\n{company}\n{address_1}\n{address_2}\n{postcode} {city}\n{country}"; // Address format for Germany

    return $address_formats;

}

Allerdings hat das bisher keine Auswirkung auf den Namen in der PDF-Rechnung von Germanized.
Wie bekomme ich den Titel als Teil des Namens in die Rechnungsadresse im PDF?

Vielen Dank!

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer