WordPress.org

Support

Support » Plugins and Hacks » [Resolved] Add Product Description to Cart

[Resolved] Add Product Description to Cart

  • punctuatedart
    Member

    @punctuatedart

    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/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author James Koster
    Participant

    @jameskoster

    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.

    punctuatedart
    Member

    @punctuatedart

    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)

    punctuatedart
    Member

    @punctuatedart

    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;
    }
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Resolved] Add Product Description to Cart’ is closed to new replies.