• Resolved Dev49.net

    (@dev49net)


    Hi Bas,
    I think it might be useful to some users. In my WooCommerce I have made the Phone field not required, so not all orders have the phone number specified in billing information. Despite this, all invoices are showing “Phone:” field, even if customer has not entered his phone number.

    How about changing your line 15 in includes/templates/invoices/global/micro/header.php from:
    <?php printf( __( 'Phone: %s', $this->textdomain ), $this->billing_phone ); ?>
    to:
    <?php if ( !empty( $this->billing_phone ) ) printf( __( 'Phone: %s', $this->textdomain ), $this->billing_phone ); ?>

    As well as line 18 in includes/templates/invoices/simple/micro/header.php from:
    <?php printf( __( 'Phone: %s', $this->textdomain ), $this->order->billing_phone ); ?>
    to:
    <?php if ( !empty( $this->order->billing_phone ) ) printf( __( 'Phone: %s', $this->textdomain ), $this->order->billing_phone ); ?>

    Worked like a charm for me.

    Cheers,
    Daniel

    https://wordpress.org/plugins/woocommerce-pdf-invoices/

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Do not show phone number if empty’ is closed to new replies.