Title: Include text for row
Last modified: May 12, 2020

---

# Include text for row

 *  Resolved [amc11](https://wordpress.org/support/users/amc11/)
 * (@amc11)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/include-text-for-row/)
 * Hi,
 * Is it possible to adjust the template file to include
    extra information for 
   column description?
 * In our case we would like to add selected variation attribute
    like 100 grams.
 * Thanks!

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

 *  Plugin Author [Bas Elbers](https://wordpress.org/support/users/baaaaas/)
 * (@baaaaas)
 * [6 years ago](https://wordpress.org/support/topic/include-text-for-row/#post-12883155)
 * The minimal template should show the variation attributes by default. If not 
   read the Readme first! topic and let me know as much information as possible 
   so we can try and reproduce the issue.
 *  Thread Starter [amc11](https://wordpress.org/support/users/amc11/)
 * (@amc11)
 * [5 years, 12 months ago](https://wordpress.org/support/topic/include-text-for-row/#post-12994269)
 * Hi,
 * Bumping this thread 🙂 Ive looked through the read me, but I cannot see any way
   to add another column (product attribute) in the pdf with values for each of 
   the purchased products.
 * Grams(attribut name)
 * Like so:
 * **Description___________Grams(attribut name)___________Items___________Total**
   
   Cheddar-200g________400g (attribute value*2)_________2________________400
 * Thanks!
    -  This reply was modified 5 years, 12 months ago by [amc11](https://wordpress.org/support/users/amc11/).
    -  This reply was modified 5 years, 12 months ago by [amc11](https://wordpress.org/support/users/amc11/).
    -  This reply was modified 5 years, 12 months ago by [amc11](https://wordpress.org/support/users/amc11/).
    -  This reply was modified 5 years, 12 months ago by [amc11](https://wordpress.org/support/users/amc11/).
    -  This reply was modified 5 years, 12 months ago by [amc11](https://wordpress.org/support/users/amc11/).
 *  Plugin Author [Bas Elbers](https://wordpress.org/support/users/baaaaas/)
 * (@baaaaas)
 * [5 years, 11 months ago](https://wordpress.org/support/topic/include-text-for-row/#post-13002308)
 * Adding a column would probably mess up the CSS.
 * You can have a look at below article which adds the SKU below the product description.
   You could use it to add the weight instead of the SKU.
 * [How to display the parent product SKU below the product description?](https://woocommerce-pdf-invoices-premium.helpscoutdocs.com/article/46-how-to-display-the-parent-product-sku-below-the-product-description)
 * Check below article on how to get the weight from a product.
    [https://docs.woocommerce.com/document/display-product-weight-archive-pages/](https://docs.woocommerce.com/document/display-product-weight-archive-pages/)
 *  Thread Starter [amc11](https://wordpress.org/support/users/amc11/)
 * (@amc11)
 * [5 years, 11 months ago](https://wordpress.org/support/topic/include-text-for-row/#post-13002718)
 * Thanks!
 * But its the PDF that is sent with the order that needs the changes.
    Not the 
   archive pages.
 * Adding one column for the table within the PDF, is that really that
    difficult?
 * Really thankful for the support.
    -  This reply was modified 5 years, 11 months ago by [amc11](https://wordpress.org/support/users/amc11/).
 *  Thread Starter [amc11](https://wordpress.org/support/users/amc11/)
 * (@amc11)
 * [5 years, 11 months ago](https://wordpress.org/support/topic/include-text-for-row/#post-13023358)
 * Hi again,
 * Ive been trying to adjust the template to include another column with attribute
   grams.
 * The problem I’m facing is this call $invoice->get_columns_data() within abstract-
   invoice.php.
 * Because no product id (SKU) is included within that return, I cannot match and
   retrieve attribute data and create another column with that information for the
   template file.
 * Is there any way to get around this, without modifying the core plugin files?
   
   Im seing $order, can this be used?
 * Thanks!
 *  Plugin Author [Bas Elbers](https://wordpress.org/support/users/baaaaas/)
 * (@baaaaas)
 * [5 years, 8 months ago](https://wordpress.org/support/topic/include-text-for-row/#post-13535185)
 * I’ve created below examples to add columns to the invoice by using filters. Not
   tested, but should work totally fine.
 *     ```
       function add_sku_column( $columns, $invoice ) {
       	$columns = array_merge( array( 'sku' => __( 'SKU', 'woocommerce-pdf-invoices' ) ), $columns );
       	return $columns;
       }
       add_filter( 'wpi_get_invoice_columns', 'add_sku_column', 10, 2 );
   
       function add_sku_column_data( $row, $item_id, $item, $invoice ) {
       	/** @var WC_Product $product */
       	$product = $item->get_product();
       	$row = array_merge( array( 'sku' =>  $product ? $product->get_sku() : '-' ), $row );
   
       	return $row;
       }
       add_filter( 'wpi_get_invoice_columns_data_row', 'add_sku_column_data', 10, 4 );
   
       function add_unit_of_measure_column( $columns, $invoice ) {
       	// Splice columns at 'quantity' column, add column and merge with last part.
       	$offset  = array_search( 'quantity', array_keys( $columns ), true );
       	$columns = array_merge(
       		array_splice( $columns, 0, $offset ),
       		array(
       			'unit_of_measure' => __( 'Unitate de masura', 'woocommerce-pdf-invoices' ),
       		),
       		$columns
       	);
   
       	return $columns;
       }
       add_filter( 'wpi_get_invoice_columns', 'add_unit_of_measure_column', 20, 2 );
   
       function add_unit_of_measure_column_data( $row, $item_id, $item, $invoice ) {
       	/** @var WC_Product $product */
   
       	$product         = $item->get_product();
       	$attribute_value = $product ? $product->get_attribute( 'Unitate de masura' ) : '';
   
       	$offset = array_search( 'quantity', array_keys( $row ), true );
       	$row    = array_merge(
       		array_splice( $row, 0, $offset ),
       		array(
       			'unit_of_measure' => $attribute_value,
       		),
       		$row
       	);
   
       	return $row;
       }
       add_filter( 'wpi_get_invoice_columns_data_row', 'add_unit_of_measure_column_data', 20, 4 );
       ```
   
 *  Thread Starter [amc11](https://wordpress.org/support/users/amc11/)
 * (@amc11)
 * [5 years, 7 months ago](https://wordpress.org/support/topic/include-text-for-row/#post-13540627)
 * This is just amazing thank you so much!!
 *  Thread Starter [amc11](https://wordpress.org/support/users/amc11/)
 * (@amc11)
 * [5 years, 7 months ago](https://wordpress.org/support/topic/include-text-for-row/#post-13630911)
 * Hi,
 * This script really helped me a lot!
    Thank you.
 * I have two more questions.
 * 1. Is it possible to remove the product name from description?
    2. How can I 
   change the filename for the pdf?
 * Thanks!

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

The topic ‘Include text for row’ is closed to new replies.

 * ![](https://ps.w.org/woocommerce-pdf-invoices/assets/icon-128x128.png?rev=1128583)
 * [Invoices for WooCommerce](https://wordpress.org/plugins/woocommerce-pdf-invoices/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/woocommerce-pdf-invoices/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/woocommerce-pdf-invoices/)
 * [Active Topics](https://wordpress.org/support/plugin/woocommerce-pdf-invoices/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woocommerce-pdf-invoices/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woocommerce-pdf-invoices/reviews/)

 * 8 replies
 * 2 participants
 * Last reply from: [amc11](https://wordpress.org/support/users/amc11/)
 * Last activity: [5 years, 7 months ago](https://wordpress.org/support/topic/include-text-for-row/#post-13630911)
 * Status: resolved