Merge pull request #15227 from woocommerce/fix/15225

A single multi-word attribute is fine for variation titles
This commit is contained in:
Mike Jolley 2017-05-23 15:06:55 +01:00 committed by GitHub
commit 90213efa46
1 changed files with 4 additions and 3 deletions

View File

@ -203,11 +203,12 @@ class WC_Product_Variation_Data_Store_CPT extends WC_Product_Data_Store_CPT impl
protected function generate_product_title( $product ) {
$attributes = (array) $product->get_attributes();
// Don't include attributes if the product has 3+ attributes.
// Do not include attributes if the product has 3+ attributes.
$should_include_attributes = count( $attributes ) < 3;
// Don't include attributes if an attribute name has 2+ words.
if ( $should_include_attributes ) {
// Do not include attributes if an attribute name has 2+ words and the
// product has multiple attributes.
if ( $should_include_attributes && 1 < count( $attributes ) ) {
foreach ( $attributes as $name => $value ) {
if ( false !== strpos( $name, '-' ) ) {
$should_include_attributes = false;