Title: Undefined variable order-details-item.php
Last modified: August 31, 2016

---

# Undefined variable order-details-item.php

 *  Resolved [Erik86](https://wordpress.org/support/users/erik86/)
 * (@erik86)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/undefined-variable-order-details-itemphp/)
 * Hi,
 * The following message is displayed on the order conformation page:
 * _Notice: Undefined variable: show\_purchase\_note in /home/xxxxx/domains/magnetenkopen.
   nl/public\_html/wp-content/plugins/woocommerce/templates/order/order-details-
   item.php on line 46_
 * Line 46 – 51 in order-details-item.php are as follows:
 * _
    <?php if ( $show\_purchase\_note && $purchase\_note ) : ?> <tr class=”product-
   purchase-note”> <td colspan=”3″><?php echo wpautop( do\_shortcode( wp\_kses\_post(
   $purchase\_note ) ) ); ?></td> </tr> <?php endif; ?>
 * I was wondering if anyone else has the same problem? WordPress and all plugins
   are updated. I use Gennesis Sample theme by Studiopress, but changing to twentythirteen
   doesn’t change anything.
 * [https://wordpress.org/plugins/woocommerce/](https://wordpress.org/plugins/woocommerce/)

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

 *  Thread Starter [Erik86](https://wordpress.org/support/users/erik86/)
 * (@erik86)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/undefined-variable-order-details-itemphp/#post-6981432)
 * I’ve been busy with it a few hours, but this seems to do the trick:
 * I’ve compared the order-details-item.php-file with antoher Woocommerce installation(
   with an older version 2.4.12) and line 46 was like this:
 * <?php if ( $order->has_status( array( ‘completed’, ‘processing’ ) ) && ( $purchase_note
   = get_post_meta( $product->id, ‘_purchase_note’, true ) ) ) : ?>
 * I replaced line 46 with above and now it seems to be working OK. I’m not sure
   if there will be problems, I’ll keep you posted if so.
 *  [pinkhare](https://wordpress.org/support/users/pinkhare/)
 * (@pinkhare)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/undefined-variable-order-details-itemphp/#post-6981622)
 * Me too. `Undefined variable: show_purchase_note` occured!
 *  Plugin Contributor [Mike Jolley](https://wordpress.org/support/users/mikejolley/)
 * (@mikejolley)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/undefined-variable-order-details-itemphp/#post-6981626)
 * This could happen if a custom email template was being used which does not use
   the order ’email_order_items_table’ method. This passes that variable into the
   template file.
 *  [pinkhare](https://wordpress.org/support/users/pinkhare/)
 * (@pinkhare)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/undefined-variable-order-details-itemphp/#post-6981629)
 * Okay, so what should we do now? ThankS!
 *  Plugin Contributor [Mike Jolley](https://wordpress.org/support/users/mikejolley/)
 * (@mikejolley)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/undefined-variable-order-details-itemphp/#post-6981630)
 * Impossible for me to say because I don’t know how your theme is handling it, 
   but I will say, if your store is in production, you should not be outputting 
   PHP notices and warnings on pages. [http://php.net/manual/en/function.error-reporting.php](http://php.net/manual/en/function.error-reporting.php)
 *  [pinkhare](https://wordpress.org/support/users/pinkhare/)
 * (@pinkhare)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/undefined-variable-order-details-itemphp/#post-6981634)
 * Thank you. I’m developing my theme. I had overrided order-details-item.php file
   in my thems’s woocommerce folder and then the error occured, but now I deleted
   the file in my theme(actually it was not as different as the original woo-template
   file at all) and the error has gone. Mysterious!
 *  [Adriano Monecchi](https://wordpress.org/support/users/designroom/)
 * (@designroom)
 * [10 years, 2 months ago](https://wordpress.org/support/topic/undefined-variable-order-details-itemphp/#post-6981682)
 * After getting the same error I’ve compared my theme’s **[order-details.php](https://github.com/woothemes/woocommerce/blob/master/templates/order/order-details.php#L25)**
   file with its WooCommerce equivalent default template. It turned out my theme’s**
   order-details.php** custom template was missing the **$show_purchase_note** and**
   $purchase_note** variables, as also its inclusion as an array within the foreach
   function as shown [here](https://github.com/woothemes/woocommerce/blob/master/templates/order/order-details.php#L36-L50)
 * The **[order-details-item.php](https://github.com/woothemes/woocommerce/blob/master/templates/order/order-details-item.php#L47)**
   template file checks for the variables mentioned above, so if the **order_details.
   php** file is adjusted to define those variables, then the **order-details-item.
   php** can be left alone with no need for changes.

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

The topic ‘Undefined variable order-details-item.php’ is closed to new replies.

 * ![](https://ps.w.org/woocommerce/assets/icon.svg?rev=3234504)
 * [WooCommerce](https://wordpress.org/plugins/woocommerce/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/woocommerce/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/woocommerce/)
 * [Active Topics](https://wordpress.org/support/plugin/woocommerce/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woocommerce/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woocommerce/reviews/)

 * 7 replies
 * 4 participants
 * Last reply from: [Adriano Monecchi](https://wordpress.org/support/users/designroom/)
 * Last activity: [10 years, 2 months ago](https://wordpress.org/support/topic/undefined-variable-order-details-itemphp/#post-6981682)
 * Status: resolved