add filter wc_is_attribute_in_product_name

The filter `wc_is_attribute_in_product_name` will allow customizations to show the variations in the cart like in WC 2.6.
This commit is contained in:
Nicola Mustone 2017-04-20 09:53:49 +03:00 committed by GitHub
parent e208e35e33
commit 7f6909040d
1 changed files with 2 additions and 1 deletions

View File

@ -331,5 +331,6 @@ function wc_attributes_array_filter_variation( $attribute ) {
* @return bool
*/
function wc_is_attribute_in_product_name( $attribute, $name ) {
return stristr( $name, ' ' . $attribute . ',' ) || 0 === stripos( strrev( $name ), strrev( ' ' . $attribute ) );
$is_in_name = stristr( $name, ' ' . $attribute . ',' ) || 0 === stripos( strrev( $name ), strrev( ' ' . $attribute ) );
return apply_filters( 'wc_is_attribute_in_product_name', $is_in_name, $attribute, $name );
}