How to add a custom class to the product loop using a custom field?

add_filter( 'woocommerce_post_class', 'add_category_class'); 
function add_category_class( $classes ) {
	$custom_videoclass = get_post_meta(get_the_ID(), 'produktvideoclass', true);
    if ( 'product' == get_post_type() ) {
     $classes[] = $custom_videoclass;
    }
    return $classes;
}
Without cookies
This website does not use cookies or tracking. More information can be found in the privacy policy.