1

On my single product pages, I would like to change the meta data so that the Category button for the product does not display. I can't seem to figure out where this is called. I've looked in various php files. Thank you for your help.

  • I was researching something else and found the answer! The php file to edit is single-product/meta.php (you can't see this via the Editor from the Dashboard; you need to FTP to get it). I removed: <?php $size = sizeof( get_the_terms( $post->ID, 'product_cat' ) ); echo $product->get_categories( ', ', '<span class="posted_in">' . _n( 'Category:', 'Categories:', $size, 'woocommerce' ) . ' ', '.</span>' ); ?> :) – user41328 Nov 4 '13 at 16:59
4

As an alternative to editing the meta template, you can prevent the meta information from being displayed on single product pages at all. This can be handy if you also don't want to display the SKUs. Here is how to do it:

remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_meta', 40 );

It goes to your functions.php.

0

Old question, but I want to point out overriding templates. Nick's answer removes all the meta display. In my case, I only wanted to remove the category and not all the meta information.

Create a copy of single product meta file to yourtheme/woocommerce/single-product/meta.php.

Remove the following line (line 38 on version 3.5):

<?php echo wc_get_product_category_list( $product->get_id(), ', ', '<span class="posted_in">' . _n( 'Category:', 'Categories:', count( $product->get_category_ids() ), 'woocommerce' ) . ' ', '</span>' ); ?>

This way, you can update WooCommerce without it overwriting your changes.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.