WC_Product::is_visible_core()
Returns whether or not the product is visible in the catalog (doesn't trigger filters).
Method of the class: WC_Product{}
No Hooks.
Return
true|false
.
Usage
// protected - for code of main (parent) or child class $result = $this->is_visible_core();
WC_Product::is_visible_core() WC Product::is visible core code WC 9.7.1
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 ( ProductStatus::TRASH === $this->get_status() ) { $visible = false; } elseif ( ProductStatus::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 && ProductStatus::PUBLISH !== $parent_product->get_status() && ! current_user_can( 'edit_post', $parent_product->get_id() ) ) { $visible = false; } } if ( 'yes' === get_option( 'woocommerce_hide_out_of_stock_items' ) && ! $this->is_in_stock() ) { $visible = false; } return $visible; }