What is the ‘real’ way to show purchase notes on the order details page?
-
Can someone please outline the proper, working, way of displaying purchase notes?
For a long time, I have been getting them to display correctly on my order details page (thankyou.php) however the strangest thing happened. I recently went in to edit a purchase note and noticed my purchase note field is completely empty now. Even though my purchase notes are still showing up on my order details pages after checkout.
This means I can’t edit purchase notes anymore. I also can’t create a new product and show it’s purchase note. It’s like the function has been completely disabled somehow – presumably after a recent WC update.
The only way I was able to have them display properly was using the following snippet found here but apparently doesn’t work anymore. Any help would be much appreciated.
<?php $items = $order -> get_items(); foreach ( $items as $item ) { $product = $order -> get_product_from_item( $item ); // copied from woocommerce/templates/emails/email-order-items.php $purchase_note = get_post_meta( $product -> id, '_purchase_note', true ); echo wpautop( do_shortcode( wp_kses_post( $purchase_note ) ) ); } ?>
- The topic ‘What is the ‘real’ way to show purchase notes on the order details page?’ is closed to new replies.