//Canonical to first pagination page in WooCoomerce categories rank math
//term link instead of the paginated link in the canonical tag:
add_filter( 'rank_math/frontend/canonical', function( $canonical ) {
if ( is_tax( 'product_cat' ) && is_paged() ) {
$object = get_queried_object();
return get_term_link( $object->term_id );
}elseif ( is_category() and is_paged()) {
$object = get_queried_object();
return get_term_link( $object->term_id );
}
return $canonical;
});