WC_Product::is_visible_core() – Returns whether or not the product is visible in the catalog (doesn’t trigger filters).

You appear to be a bot. Output may be restricted

Description

Returns whether or not the product is visible in the catalog (doesn't trigger filters).

Usage

$bool = WC_Product::is_visible_core();

Parameters

Returns

bool

Source

File name: woocommerce/includes/abstracts/abstract-wc-product.php
Lines:

1 to 23 of 23
  protected function is_visible_core() {
    $visible = 'visible' === $this->get_catalog_visibility() || ( is_search() && 'search' === $this->get_catalog_visibility() ) || ( ! is_search() && 'catalog' === $this->get_catalog_visibility() );

    if ( 'trash' === $this->get_status() ) {
      $visible = false;
    } elseif ( 'publish' !== $this->get_status() && ! current_user_can( 'edit_post', $this->get_id() ) ) {
      $visible = false;
    }

    if ( $this->get_parent_id() ) {
      $parent_product = wc_get_product( $this->get_parent_id() );

      if ( $parent_product && 'publish' !== $parent_product->get_status() ) {
        $visible = false;
      }
    }

    if ( 'yes' === get_option( 'woocommerce_hide_out_of_stock_items' ) && ! $this->is_in_stock() ) {
      $visible = false;
    }

    return $visible;
  }
 

 View on GitHub View on Trac