get deepest Woocommerce Product Category on Archivepage

On category archives (or any the archive for any taxonomy term) you can get the current term with get_queried_object().

If you just need the ID you can use get_queried_object_id().

If you want to output the name of the term, you can use single_term_title().

Keep in mind that archive-product.php will also be used for the Shop page, for all products, so make sure to check is_product_category() before using any of the above functions.

tech