To take away all class from a WooCommerce product, you need to use the wp_set_object_terms() perform.
Right here is an instance of how you need to use wp_set_object_terms() to take away classes from a product:
// Set the product's classes to an empty array
$classes = array();
wp_set_object_terms( $product->ID, $classes, 'product_cat' );
If you wish to take away a particular class, you need to use the wp_remove_object_terms() perform as a substitute. This perform permits you to take away particular phrases from an object.
Right here is an instance of how you need to use wp_remove_object_terms() to take away a particular class from a product:
// Set the class ID to take away
$category_id = 123;
// Take away the class from the product
wp_remove_object_terms( $product->ID, $category_id, 'product_cat' );
This code will take away the class with an ID of 123 from the present product