woocommerce_product_variation_title
Filters the generated variation product title.
Usage
add_filter( 'woocommerce_product_variation_title', 'wp_kama_woocommerce_product_variation_title_filter', 10, 4 );
/**
* Function for `woocommerce_product_variation_title` filter-hook.
*
* @param string $title Generated variation title.
* @param WC_Product $product Variation product object.
* @param string $title_base Parent product title.
* @param string $title_suffix Formatted attribute values, or an empty string.
*
* @return string
*/
function wp_kama_woocommerce_product_variation_title_filter( $title, $product, $title_base, $title_suffix ){
// filter...
return $title;
}
- $title(string)
- Generated variation title.
- $product(WC_Product)
- Variation product object.
- $title_base(string)
- Parent product title.
- $title_suffix(string)
- Formatted attribute values, or an empty string.
Changelog
| Since 3.0.0 | Introduced. |
Where the hook is called
woocommerce_product_variation_title
woocommerce/includes/data-stores/class-wc-product-variation-data-store-cpt.php 319
return apply_filters( 'woocommerce_product_variation_title', $title_suffix ? $title_base . $separator . $title_suffix : $title_base, $product, $title_base, $title_suffix );