• 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)
  • add_action( 'woocommerce_after_shop_loop_item_title', 'insert_description', 20 );
    function insert_description() {
      global $product;
      print substr( $product->get_description(), 0, 100 );
    }
    Thread Starter emmablue

    (@emmablue)

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

    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)
  • The topic ‘Adding Product Fields to Product Categories Page’ is closed to new replies.