Add post tags to Woocommerce products

  WooCommerce

If you have post tags and you want to use them for your WooCommerce products also, the following will definitely help you out.  It works great, but the only caveat is when you click on the tag itself, it will only show posts related to the tag.

If you know how to show both post and product tags when clicking on tag link, please do share.

It’s always best to do this in your child theme’s function.php file:

// ADD POST TAGS TO PRODUCT ADMIN PAGE
function custom_wc_add_post_tags( $args ){
$args['taxonomies'] = array('post_tag');
return $args;
}
add_filter( 'woocommerce_register_post_type_product', 'custom_wc_add_post_tags' );

// REMOVE PROD TAGS FROM PRODUCT ADMIN PAGE
add_filter('woocommerce_taxonomy_objects_product_tag', '__return_empty_array');
add_filter('woocommerce_taxonomy_args_product_tag', '__return_empty_array');

reference: https://stackoverflow.com/questions/45135477/how-to-add-post-tags-to-woocommerce-products

 

 

LEAVE A COMMENT