WC_Product::set_catalog_visibility( string $visibility )

Set catalog visibility.


Description Description


Parameters Parameters

$visibility

(string) (Required) Options: 'hidden', 'visible', 'search' and 'catalog'.


Top ↑

Source Source

File: includes/abstracts/abstract-wc-product.php

	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 );
	}

Top ↑

Changelog Changelog

Changelog
Version Description
3.0.0 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.