1) Open your templates/content-product_cat.php
file.
2) Locate the following piece of code:
<li <?php wc_product_cat_class(); ?>>
<?php do_action( 'woocommerce_before_subcategory', $category ); ?>
<a href="https://wordpress.stackexchange.com/questions/204313/<?php echo get_term_link( $category->slug,"product_cat' ); ?>">
3) Replace the line
<a href="https://wordpress.stackexchange.com/questions/204313/<?php echo get_term_link( $category->slug,"product_cat' ); ?>">
for the following piece of code:
<?php if ($category->name == "adults1" || $category->name == "adults2") { ?>
<a onclick="return confirm('The content you are about to view are of a mature matter. Please be advised that the content may not be suitable for those under the age of 18')" href="https://wordpress.stackexchange.com/questions/204313/<?php echo get_term_link( $category->slug,"product_cat' ); ?>">
<?php } else { ?>
<a href="https://wordpress.stackexchange.com/questions/204313/<?php echo get_term_link( $category->slug,"product_cat' ); ?>">
<?php } ?>
4) Replace "adults1"
and "adults2"
for the names of the two categories you want to control.
Hope it solves your issue.