Calculations in functions.php [closed]

On those lines get_post_meta() will return an array because by default the third argument of get_post_meta() is false.

If you want to return a single value you should call it like so:

get_post_meta( get_the_ID(), 'invoice_service_amount', true );

Additionally, you may want to get the post meta first and then ensure you have a value (wrapping that multiplication in a conditional statement to avoid errors). Perhaps something like:

$invoice_service_amount = get_post_meta( get_the_ID(), 'invoice_service_amount', true );
$invoice_service_quantity = get_post_meta( get_the_ID(), 'invoice_service_quantity', true );
if ( ! empty( $invoice_service_amount ) && ! empty( $invoice_service_quantity ) ) {
    $line_total = absint( $invoice_service_amount ) * absint( $invoice_service_quantity );
else {
    $line_total = 0;
}