WordPress at Your Fingertips
function is not described

WC_Product::set_catalog_visibility() public WC 3.0.0

Set catalog visibility.

{} It's a method of the class: WC_Product{}

No Hooks.

Return

null. Nothing.

Usage

$WC_Product = new WC_Product();
$WC_Product->set_catalog_visibility( $visibility );
$visibility(string) (required)
Options: 'hidden', 'visible', 'search' and 'catalog'.

Changelog

Since 3.0.0 Introduced.

Code of WC_Product::set_catalog_visibility() WC 5.8.0

public function set_catalog_visibility( $visibility ) {
	$options = array_keys( wc_get_product_visibility_options() );
	if ( ! in_array( $visibility, $options, true ) ) {
		$this->error( 'product_invalid_catalog_visibility', __( 'Invalid catalog visibility option.', 'woocommerce' ) );
	}
	$this->set_prop( 'catalog_visibility', $visibility );
}