Thread Starter
Erik86
(@erik86)
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.
Me too. Undefined variable: show_purchase_note occured!
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.
Okay, so what should we do now? ThankS!
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
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!
After getting the same error I’ve compared my theme’s order-details.php 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
The order-details-item.php 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.