Currently, I am trying to customise the override WooCommerce.php file. Now, in this file,
<section id="content woocommerce" class="grid-block woocommerce">
<ul id="products" class="subcategory-products products">
<?php woocommerce_content(); ?>
</ul>
</section>
The output likes:
<li class="post-15 product type-product status-publish hentry first instock">
<a href="http://shop.bbpixelz.dk/product/i-phone-ai-template/">
<img width="150" height="150" src="http://shop.bbpixelz.dk/wp-content/uploads/2014/01/iphone-ai-template-150x150.png" class="attachment-shop_catalog wp-post-image" alt="iphone-ai-template">
<h3>I-Phone Vector Template</h3>
<span class="price"><span class="amount">$2</span></span>
</a>
<a href="/?add-to-cart=15" rel="nofollow" data-product_id="15" data-product_sku="ai-iphone" class="add_to_cart_button button product_type_simple">Add to cart</a>
</li>
What I am trying to do is to change the class name, currently the class name is post-15 product ...
. I would like to change the class name to product category.
Could someone help me?
There is no particular hook available to deal with classes in products list.
Therefore, we need to edit, “content-product.php” present in, “template” folder of “woocommerce” plugin.
We can add following code:
after,
statement.
This will result in the following output:
where, “General” and “Special” are categories.
Here I am fetching, product categories slugs and appending it to products class.