• Resolved antonk9000

    (@antonk9000)


    Is there a guide to editing the individual products within the category page?

    On each individual product, I need to add some information, but neither WooCommerce nor the theme options give me what I need.

    I would prefer a plugin/visual type solution, but if I have to, I can edit the individual template… just need some pointers on: where is it (the template file responsible for building each individual product “tile” in a category), and how to edit it in the proper manner so it doesn’t get destroyed by theme changes.

    Any advice would be appreciated!

Viewing 1 replies (of 1 total)
  • I don’t know of a guide.

    I wouldn’t edit the template. You can write code to hook into the template at the point where you want to insert the additional text. See: templates/content-product.php.

    For example, to hook in just after the add-to-cart, you would use:
    add_action( 'woocommerce_after_shop_loop_item', 'my_custom_function', 20 );

    Your new function would start with global $product; to determine which product it was in that tile and then determine the appropriate text. For best results, your function could pull in the text from a custom field on the product edit page. You may be able to use the short-description field depending on your setup.

    Your new code goes in functions.php for your child theme or you can use the “my Custom Functions” plugin. By not editing the template, you can avoid update issues.

Viewing 1 replies (of 1 total)
  • The topic ‘How to edit individual product “tiles” in category?’ is closed to new replies.