There is no primary category unless some plugin is making one, like Yoast. But then you would have to query the database for Yoast value in the post meta table _yoast_wpseo_primary_category. ![]()
I wonder if that works for post categories? I am not using woocommerce.
Thank you!