It returns null, because WooCommerce doesn’t use tags for products. It uses custom taxonomy called product_tag
.
So instead of
$tags = get_tags();
You should use
$tags = get_terms( 'product_tag' );
It returns null, because WooCommerce doesn’t use tags for products. It uses custom taxonomy called product_tag
.
So instead of
$tags = get_tags();
You should use
$tags = get_terms( 'product_tag' );