• Resolved denniscabrera

    (@denniscabrera)


    I would like to add the item description to my order details. I have found some topics on adding some code to my child theme’s function.php but they do not seem to work.

    Any help would be appreciated.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter denniscabrera

    (@denniscabrera)

    I was thinking that for my purposes it might even be better to show a specific attribute in my order details rather than item description.

    Please let me know if this is possible.

    Thank you!

    Rynald0s

    (@rynald0s)

    Automattic Happiness Engineer

    Hi @denniscabrera!

    The following code works:

    add_filter( 'woocommerce_order_item_name', 'add_single_excerpt_to_order_item', 10, 3 );
    function add_single_excerpt_to_order_item( $item_name, $item, $is_visible ){
        $product_id = $item->get_product_id(); // Get the product Id
        $excerpt = get_the_excerpt( $product_id ); // Get the short description
    
        return $item_name . '<br><p class="item-description">' . $excerpt ; '</p>';
    }

    You can add this code to your site using the Code snippets plugin.

    Here’s some information on how to add code to your site the correct way:

    https://rynaldo.com/how-to-add-custom-code-to-your-woocommerce-wordpress-site-the-right-way/

    Cheers!

    mother.of.code

    (@imazed)

    The Mother of Code

    I’m resolving this topic as it has gone silent – please open up a new topic if you need more help with anything!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Adding item description to order details’ is closed to new replies.