woocommerce_product_class
Filter the product class name.
Usage
add_filter( 'woocommerce_product_class', 'wp_kama_woocommerce_product_class_filter', 10, 4 ); /** * Function for `woocommerce_product_class` filter-hook. * * @param string $classname Classname. * @param string $product_type Product type. * @param string $context Context. * @param int $product_id Product ID. * * @return string */ function wp_kama_woocommerce_product_class_filter( $classname, $product_type, $context, $product_id ){ // filter... return $classname; }
- $classname(string)
- Classname.
- $product_type(string)
- Product type.
- $context(string)
- Context.
- $product_id(int)
- Product ID.
Changelog
Since 3.0.0 | Introduced. |
Where the hook is called
woocommerce_product_class
woocommerce/includes/class-wc-product-factory.php 73
$classname = apply_filters( 'woocommerce_product_class', self::get_classname_from_product_type( $product_type ), $product_type, ProductType::VARIATION === $product_type ? 'product_variation' : 'product', $product_id );