wc_is_attribute_in_product_name()
Check if an attribute is included in the attributes area of a variation name.
Hooks from the function
Return
true|false
.
Usage
wc_is_attribute_in_product_name( $attribute, $name );
- $attribute(string) (required)
- Attribute value to check for.
- $name(string) (required)
- Product name to check in.
Changelog
Since 3.0.2 | Introduced. |
wc_is_attribute_in_product_name() wc is attribute in product name code WC 9.6.1
function wc_is_attribute_in_product_name( $attribute, $name ) { $is_in_name = stristr( $name, ' ' . $attribute . ',' ) || 0 === stripos( strrev( $name ), strrev( ' ' . $attribute ) ); return apply_filters( 'woocommerce_is_attribute_in_product_name', $is_in_name, $attribute, $name ); }