• Resolved hyp0xia

    (@hyp0xia)


    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 ) ) );
        }
    ?>
    
Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Support John Coy a11n

    (@johndcoy)

    Automattic Happiness Engineer

    Hi @hyp0xia

    The purchase notes show on the order received page by default. If this content is missing then it could be a result of the active theme applying outdated template overrides to WooCommerce files. You can try another theme like Twenty Seventeen to confirm this.

    If you’d like to include the notes in the email template, you can use this article for help:

    https://www.sellwithwp.com/how-to-show-woocommerce-product-information-after-purchase/

    Hope this helps,

    Thread Starter hyp0xia

    (@hyp0xia)

    @johndcoy

    Thanks John!

    I did what you said and changed my theme to TwentySeventeen and proceeded to checkout with a new product that I had created which has a purchase note. The purchase note still does not appear on the order details page or even the email confirmation.

    Any other ideas?

    Plugin Support John Coy a11n

    (@johndcoy)

    Automattic Happiness Engineer

    Hi @hyp0xia

    My only assumption is that a theme or plugin’s cached data is still causing it to not show. Here is a screenshot of the order note from the checkout page on the order received page:

    https://cld.wthms.co/B7OZsu

    After switching the theme and disabling all plugins, can you test again and provide me with the Status report from WooCommerce > Status > Get system status?

    I can’t see that snippet working @hyp0xia. It’s not establishing an action or a function and in order to customize WC you need to write a hook in functions first and then you can add that snippet to said file.

    It looks good on paper but it doesn’t know where to be applied.

    Plugin Support John Coy a11n

    (@johndcoy)

    Automattic Happiness Engineer

    Hi @hyp0xia

    We haven’t heard from you in a while, so I’ll mark this ticket as resloved now.

    Thread Starter hyp0xia

    (@hyp0xia)

    @johndcoy
    @stefsternyc

    Sorry I didn’t see any reply notification emails for this.

    That snippet worked flawlessly for displaying my purchase notes as they would never show on the order details page (thankyou.php) prior to using it

    And just to be clear, these are purchase notes and not notes left by the customer.

    As it still stands no purchase notes are being posted on order details page (thankyou.php) or emails. Plugins have not changed either. Maybe WC updated and now there’s a conflict.

    If that snippet is no good, what snippet would you recommend to show the purchase notes?

    Also if it helps, the site is running version 3.1.1

    • This reply was modified 6 years, 2 months ago by hyp0xia.
    Plugin Support John Coy a11n

    (@johndcoy)

    Automattic Happiness Engineer

    Hi @hyp0xia

    Thanks for getting back. There isn’t a specific snippet to provide you but here is where you can find the code that gets the purchase_note:

    https://github.com/woocommerce/woocommerce/blob/d0491072e8a7d0a4535db0ec2bae4a6d43ff64fd/templates/order/order-details.php#L51

    You can team up with a developer or you plugin author to create a custom solution for you.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘What is the ‘real’ way to show purchase notes on the order details page?’ is closed to new replies.