WC_Product::has_child PHP Method

has_child() public method

Returns whether or not the product has any child product.
public has_child ( ) : boolean
return boolean
    public function has_child()
    {
        return 0 < count($this->get_children());
    }

Usage Example

 public function is_bulk_variation_form()
 {
     global $post;
     if (!$post) {
         return false;
     }
     /** Remove validation (_bv_type) -- 03/02/2016 **/
     if (!is_product()) {
         return false;
     }
     /****/
     /** Validate if exits role -- 03/02/2016 **/
     if ($this->role_exists('wholesale_customer')) {
         if (!current_user_can('wholesale_customer')) {
             return false;
         }
     }
     // 2.0 Compat
     if (function_exists('get_product')) {
         $product = get_product($post->ID);
     } else {
         $product = new WC_Product($post->ID);
     }
     if ($product && !$product->has_child() && !$product->is_type('variable')) {
         return false;
     }
     return apply_filters('woocommerce_bv_render_form', true);
 }
All Usage Examples Of WC_Product::has_child
WC_Product