N
N
Nikita2021-06-07 08:38:53
WordPress
Nikita, 2021-06-07 08:38:53

How to get category slug in category listing in Woocommerce?

Hello!
In the category listing, i.e. in the content-product_cat.php template, I need to get the name of the anchor (slug) of each category.
I want to add this label data attribute to the li list.
Those. I want to get something like this:

<li <?php wc_product_cat_class( '', $category ); ?> data-name="<?php echo product_cat_slug; ?>">

How can I do it?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question