get_billing_company() ); $first = trim( $order->get_billing_first_name() ); $last = trim( $order->get_billing_last_name() ); if ( $first || $last ) { $fallback_name = trim( $first . ' ' . $last ); } } $final_value = $company ? $company : $fallback_name; $text = str_replace( '%company%', $final_value, $text ); return $text; } }