This is a bit tricky because the address is provided to our plugin ‘as-is’ (fully formatted) by WooCommerce… You may be able to get the desired result with the following code snippet:
add_filter( 'wpo_wcpdf_billing_address', 'wpo_wcpdf_address_company_name', 10, 2 );
add_filter( 'wpo_wcpdf_shipping_address', 'wpo_wcpdf_address_company_name', 10, 2 );
function wpo_wcpdf_address_company_name( $address, $document ) {
if ( !empty($document->order) ) {
$address_type = str_replace( array( 'wpo_wcpdf_', '_address'), '', current_filter() );
$full_name = $document->order->{"get_formatted_".$address_type."_full_name"}();
$company = $document->order->{"get_".$address_type."_company"}();
if (!empty($company)) {
$address = str_replace( array( $full_name."<br>", $full_name."<br/>", $full_name ), '', $address);
}
}
return $address;
}
If you haven’t worked with code snippets (actions/filters) or functions.php before, read this guide: How to use filters
Hope that helps!