Support » Plugin: WooCommerce » Adding Product Fields to Product Categories Page

  • Resolved emmablue

    (@emmablue)


    I’m wondering how to add pre-existing product fields (such as the product description) to the product category page when a category is set to display products.

    The default display includes the product photo, name and price, but I want to include a trimmed version of the description as well. I’ve found information for how to display a custom field on the product category page, but not how to display a pre-existing field in this template. Any suggestions?

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • lorro

    (@lorro)

    add_action( 'woocommerce_after_shop_loop_item_title', 'insert_description', 20 );
    function insert_description() {
      global $product;
      print substr( $product->get_description(), 0, 100 );
    }
    emmablue

    (@emmablue)

    Thank you! Where should that action be put? loop.php or content-single.php?

    lorro

    (@lorro)

    Neither, because any edits to core files will be lost during the next update.

    Snippets can go in functions.php for your child theme or you can try a code snippets plugin.

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.