• Resolved doubleedesign

    (@doubleedesign)


    Trying to work out whether it’s possible to add classes to products using a filter, similar to how you do it with body_class? Here’s what I have so far, but it’s not working:

    function doublee_add_product_rating_class($classes) {
    	// Do stuff to get the classes, e.g.:
    	$classes[] .= 'my-class';
    	
    	return $classes;
    }
    add_filter('wc_get_product_class', 'doublee_add_product_rating_class'); 

    Is something like this possible? If so, what is the correct way to do it?

    Thanks for your time!

Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Programmatically adding a class to products’ is closed to new replies.