• I tried to add in the bank details to my PDF invoice. However, when I add in the PDFBANKDETAILS to my template.php, nothing comes out.

    My BACS is populated with all the information required. Can anyone help?

    /**
     * Add Bank Details to footer from WooCommerce BACS settings
     *
     * Uses template tag PDFBANKDETAILS
     *
     * 1 - Add the template tag to template.php
     * 2 - Add this code to the theme functions.php
     * 3 - check invoice layout and modify CSS in template.php as necessary
     */
    add_filter ( 'pdf_content_additional_content' , 'pdf_additional_content_bank_details_footer' );
    function pdf_additional_content_bank_details_footer( $content ) {
    
    	$woocommerce_bacs_settings = get_option( 'woocommerce_bacs_settings' );
    
    	$pdfbankdetails = '';
    
    	if( $woocommerce_bacs_settings['account_name'] ) :
    		$pdfbankdetails.= 'Account Name :' .$woocommerce_bacs_settings['account_name']. ' ';
    	endif;
    	if( $woocommerce_bacs_settings['account_number'] ) :
    		$pdfbankdetails.= 'Account Number :' .$woocommerce_bacs_settings['account_number']. ' ';
    	endif;
    	if( $woocommerce_bacs_settings['sort_code'] ) :
    		$pdfbankdetails.= 'Sort Code :' .$woocommerce_bacs_settings['sort_code']. ' ';
    	endif;
    	if( $woocommerce_bacs_settings['bank_name'] ) :
    		$pdfbankdetails.= '<br />Bank Name :' .$woocommerce_bacs_settings['bank_name']. ' ';
    	endif;
    	if( $woocommerce_bacs_settings['iban'] ) :
    		$pdfbankdetails.= 'IBAN : ' .$woocommerce_bacs_settings['iban']. ' ';
    	endif;
    	if( $woocommerce_bacs_settings['bic'] ) :
    		$pdfbankdetails.= 'BIC : ' .$woocommerce_bacs_settings['bic'];
    	endif;
    
    	$content = str_replace( 'PDFBANKDETAILS', $pdfbankdetails, $content );
        return $content;
    
    }

  • The topic ‘Hooking BACS Info Into PDF Invoice’ is closed to new replies.