$value ) { $attribute = new \WC_Product_Attribute(); $attribute->set_id( $key ); $attribute->set_name( $key ); $attribute->set_options( [$value] ); $visible = ! in_array( $key, self::HIDDEN_ATTRIBUTES ); $attribute->set_visible( $visible ); $attributes[] = $attribute; } return $attributes; } }