Title: Adding a data from other plugin
Last modified: January 11, 2021

---

# Adding a data from other plugin

 *  [ahranalytics](https://wordpress.org/support/users/ahranalytics/)
 * (@ahranalytics)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/adding-a-data-from-other-plugin/)
 * I want to add two data from the plugin I am using to the PDF Invoice, the plugin
   is Checkout Field Editor for WooCommerce which I added viber no. and mobile no.
 * Names:
 * billing_phone
    billing_viber
 * I am not into codes so please help me! Any help would be much appreciated.

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

 *  Plugin Contributor [alexmigf](https://wordpress.org/support/users/alexmigf/)
 * (@alexmigf)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/adding-a-data-from-other-plugin/#post-13891227)
 * Hello [@ahranalytics](https://wordpress.org/support/users/ahranalytics/)
 * The easy way is using our [Premium Templates extension](https://wpovernight.com/downloads/woocommerce-pdf-invoices-packing-slips-premium-templates/)
   by adding those custom field names to a [custom block](https://docs.wpovernight.com/woocommerce-pdf-invoices-packing-slips/using-custom-blocks/#can-i-add-the-data-of-my-own-custom-field).
 * Alternatively you can also display those using a code snippet. Please read this
   documentation page: [How to display a custom field](https://docs.wpovernight.com/woocommerce-pdf-invoices-packing-slips/displaying-a-custom-field/)
 *  Thread Starter [ahranalytics](https://wordpress.org/support/users/ahranalytics/)
 * (@ahranalytics)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/adding-a-data-from-other-plugin/#post-13894829)
 * [@alexmigf](https://wordpress.org/support/users/alexmigf/)
 * I am always keen to buy the premiumship but I want to analyze first if this plugin
   really helps me in terms of technicalities before buying it.
 * Thank you though for sending the link for customization, however none of the 
   code is working for me. See my code below:
 * add_action( ‘wpo_wcpdf_after_order_data’, ‘wpo_wcpdf_billing_viber’, 10, 2 );
   
   function wpo_wcpdf_billing_viber ($template_type, $order) { if ($template_type
   == ‘packing-slip’) { $document = wcpdf_get_document( $template_type, $order );?
   > <tr class=”billing_viber”> <th>Viber:</th> <td><?php $document->custom_field(‘
   billing_viber’); ?></td> </tr> <?php } }
 * I am trying to put the billing_viber data to the PDF invoice.
 *  Plugin Contributor [alexmigf](https://wordpress.org/support/users/alexmigf/)
 * (@alexmigf)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/adding-a-data-from-other-plugin/#post-13896386)
 * Hi [@ahranalytics](https://wordpress.org/support/users/ahranalytics/)
 * Try this instead:
 *     ```
       add_action( 'wpo_wcpdf_after_order_data', function( $document_type, $order ) {
       	if ( ! empty($order) && $document_type == 'packing-slip' ) {
       		?>
       		<tr class="billing_viber">
       			<th>Viber:</th>
       			<td><?= $order->get_meta('billing_viber'); ?></td>
       		</tr>
       		<?php
       	}
       }, 10, 2 );
       ```
   
 * If you never worked with actions/filters, please read this documentation page:
   [How to use filters](https://docs.wpovernight.com/general/how-to-use-filters/)
 *  Thread Starter [ahranalytics](https://wordpress.org/support/users/ahranalytics/)
 * (@ahranalytics)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/adding-a-data-from-other-plugin/#post-13898263)
 * Hi [@alexmigf](https://wordpress.org/support/users/alexmigf/)
 * Thanks! Not what I want but I found a way transferring the data to PDF Invoice
   not in the packing slips.
 * Last one before I mark this as resolved, I want to add a phone number as well
   but it is not working and the phone number I input didnt reflected on the PDF
   Invoice, see my code:
 *     ```
       //Viber
       add_action( 'wpo_wcpdf_after_order_data', function( $document_type, $order ) {
       	if ( ! empty($order) && $document_type == 'invoice' ) {
       		?>
       		<tr class="billing_viber">
       			<th>Viber:</th>
       			<td><?= $order->get_meta('billing_viber'); ?></td>
       		</tr>
       		<?php
       	}
       }, 10, 2 );
   
       //Phone 
       add_action( 'wpo_wcpdf_after_order_data', function( $document_type, $order ) {
       	if ( ! empty($order) && $document_type == 'invoice' ) {
       		?>
       		<tr class="billing_phone">
       			<th>Contact no:</th>
       			<td><?= $order->get_meta('billing_phone'); ?></td>
       		</tr>
       		<?php
       	}
       }, 10, 2 );
       ```
   
 * Screenshot:[https://imgur.com/TFnare0](https://imgur.com/TFnare0)
 *  Plugin Contributor [alexmigf](https://wordpress.org/support/users/alexmigf/)
 * (@alexmigf)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/adding-a-data-from-other-plugin/#post-13902224)
 * Hi [@ahranalytics](https://wordpress.org/support/users/ahranalytics/)
 * I set it to ‘packing-slip’ because your example [here](https://wordpress.org/support/topic/adding-a-data-from-other-plugin/#post-13894829)
   had it.
 * I believe the phone meta key is: `_billing_phone`

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

The topic ‘Adding a data from other plugin’ is closed to new replies.

 * ![](https://ps.w.org/woocommerce-pdf-invoices-packing-slips/assets/icon-256x256.
   png?rev=2189942)
 * [PDF Invoices & Packing Slips for WooCommerce](https://wordpress.org/plugins/woocommerce-pdf-invoices-packing-slips/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/woocommerce-pdf-invoices-packing-slips/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/woocommerce-pdf-invoices-packing-slips/)
 * [Active Topics](https://wordpress.org/support/plugin/woocommerce-pdf-invoices-packing-slips/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woocommerce-pdf-invoices-packing-slips/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woocommerce-pdf-invoices-packing-slips/reviews/)

 * 5 replies
 * 2 participants
 * Last reply from: [alexmigf](https://wordpress.org/support/users/alexmigf/)
 * Last activity: [5 years, 4 months ago](https://wordpress.org/support/topic/adding-a-data-from-other-plugin/#post-13902224)
 * Status: not resolved