I use Woocommerce in my theme and was wondering how to get the unique category, when checking terms.
what I did so far:
- I enabled the theme supprt
add_theme_support( 'woocommerce' );
in the functions php. - I created a folder woocommerce and a file archive-product.php
- The file is reached for the url `example.com/product-category/categoryname1/
- I use this code to get the categroies from woocommerce products:
$terms = get_the_terms(get_the_ID(), 'product_cat');
The thing is, that I get more than one categroy. Namely all of the first product (post) in my product list (starting with letter "A.." and allocated for the two main and two subcategories).
I would like to get only the categoryname1
entry.
What did I do wrong?
Has this something to do with the special permalink configuration for the category-base?