Created
September 12, 2013 06:39
Revisions
-
ChromeOrange created this gist
Sep 12, 2013 .There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,54 @@ /** * Add Bank Details under notes section 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' ); function pdf_additional_content_bank_details( $content ) { $woocommerce_bacs_settings = get_option( 'woocommerce_bacs_settings' ); $pdfbankdetails = '<h2>Bank Details</h2>'; $pdfbankdetails .= '<table width="100%">'; if( $woocommerce_bacs_settings['account_name'] ) : $pdfbankdetails.= '<tr>'; $pdfbankdetails.= '<td width="50%">Account Name</td><td width="50%">' .$woocommerce_bacs_settings['account_name']. '</td>'; $pdfbankdetails.= '</tr>'; endif; if( $woocommerce_bacs_settings['account_number'] ) : $pdfbankdetails.= '<tr>'; $pdfbankdetails.= '<td width="50%">Account Number</td><td width="50%">' .$woocommerce_bacs_settings['account_number']. '</td>'; $pdfbankdetails.= '</tr>'; endif; if( $woocommerce_bacs_settings['sort_code'] ) : $pdfbankdetails.= '<tr>'; $pdfbankdetails.= '<td width="50%">Sort Code</td><td width="50%">' .$woocommerce_bacs_settings['sort_code']. '</td>'; $pdfbankdetails.= '</tr>'; endif; if( $woocommerce_bacs_settings['bank_name'] ) : $pdfbankdetails.= '<tr>'; $pdfbankdetails.= '<td width="50%">Bank Name</td><td width="50%">' .$woocommerce_bacs_settings['bank_name']. '</td>'; $pdfbankdetails.= '</tr>'; endif; if( $woocommerce_bacs_settings['iban'] ) : $pdfbankdetails.= '<tr>'; $pdfbankdetails.= '<td width="50%">IBAN</td><td width="50%">' .$woocommerce_bacs_settings['iban']. '</td>'; $pdfbankdetails.= '</tr>'; endif; if( $woocommerce_bacs_settings['bic'] ) : $pdfbankdetails.= '<tr>'; $pdfbankdetails.= '<td width="50%">BIC</td><td width="50%">' .$woocommerce_bacs_settings['bic']. '</td>'; $pdfbankdetails.= '</tr>'; endif; $pdfbankdetails.= '</table>'; $content = str_replace( '[[PDFBANKDETAILS]]', $pdfbankdetails, $content ); return $content; }