I'm trying to add classes to the WooCommerce single product pages, specifically the "product" div on the product page, but other elements too - using hooks and filters.
I'm not great with PHP, I'm more of a front-end developer, but I've been tasked with styling WooCommerce to fit in with a custom Wordpress theme.
I've used the below code before to add classes to the body element in Wordpress through the functions.php
file. I found the "product" div on the product page in the WooCommerce templates and copied the filter for this, but it doesn't seem to work.
add_filter( 'wc_product_class','my_product_class' );
function my_product_class( $classes ) {
$classes[] = 'my-product-class';
return $classes;
}
Any help or pointers to what I should be doing to achieve this would be very much appreciated. I'm adding classes with JS for now, but that's probably not a great idea!