WordPress.org

Ready to get started?Download WordPress

Forums

WooCommerce - excelling eCommerce
[resolved] Add Product Description to Cart (4 posts)

  1. punctuatedart
    Member
    Posted 1 year ago #

    How can I add the product description to the cart underneath the title?

    Been searching for two days and the only slightly helpful link I've found contains code for how to do this on category pages, but I'm having trouble implementing this in the cart.

    It seems like this is simple to do with hooks placed in functions.php, but I don't know how to write them and the reference lists are all over the place. I have a template file that is overriding the cart.php file - would GREATLY appreciate code for either file.

    Thank you!

    http://wordpress.org/extend/plugins/woocommerce/

  2. jameskoster
    Member
    Plugin Author

    Posted 1 year ago #

    Overwriting the cart template in your theme isn't a bad thing - you're safe doing it that way (just be sure to test before updating WooCommerce core).

    Off the top of my head there aren't any hooks in this template anyway so editing the template is probably the best way to do this anyway.

  3. punctuatedart
    Member
    Posted 12 months ago #

    Thank you for the quick response!

    I'm still working on this issue a week later:

    How do I change the template? I don't know what code to use or where to insert it (although I could probably figure out the WHERE if I had the WHAT)

  4. punctuatedart
    Member
    Posted 12 months ago #

    HA! That link WAS useful.
    The key to this is to add a short description in the product (this is separate from the regular description, and is located at the bottom of the page)

    functions.php
    No changes necessary to the cart file. Add this code within the functions.php file:

    function wc_checkout_description_so_15127954( $other_data, $cart_item )
    {
        $post_data = get_post( $cart_item['product_id'] );
        $other_data[] = array( 'name' =>  $post_data->post_excerpt );
        return $other_data;
    }

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic