I am using Move product tags to WooCommerce product description answer code, but it moves the whole section, with everything I have there: sku, categories. I want to move only the tags part to another area. Can anyone help me please?
First you will need to remove the tags by editing the template: /woocommerce/single-product/meta.php
. You will need to remove the entire row:
<?php echo wc_get_product_tag_list( $product->get_id(), ', ', '<span class="tagged_as">' . _n( 'Tag:', 'Tags:', count( $product->get_tag_ids() ), 'woocommerce' ) . ' ', '</span>' ); ?>
See Template structure & Overriding templates via a theme to learn how.
At this point you will have successfully removed the tags from the meta.php
template. Now you will need to add them where you want them. Using your function, you can get it like this:
add_filter( 'the_content', 'woocommerce_product_description_and_meta' );
function woocommerce_product_description_and_meta( $content ) {
// Only for single product pages (woocommerce)
if ( is_product() ) {
global $product;
$tags = wc_get_product_tag_list( $product->get_id(), ', ', '<span class="tagged_as">' . _n( 'Tag:', 'Tags:', count( $product->get_tag_ids() ), 'woocommerce' ) . ' ', '</span>' );
$content .= $tags;
}
return $content;
}
The code has been tested and works. Add it to your active theme's functions.php.