CatalogVisibility
in package
Enum class for all the catalog visibility values.
Table of Contents
- CATALOG = 'catalog'
- Product is visible on the shop page only.
- HIDDEN = 'hidden'
- Product is invisible on both shop and search results, but can still be accessed directly.
- SEARCH = 'search'
- Product visible in the search results only.
- VISIBLE = 'visible'
- Product is visible on both shop and search results.
- get_all() : array<string|int, string>
- Returns every catalog visibility value defined by this enum, as a flat list.
Constants
CATALOG
Product is visible on the shop page only.
public
mixed
CATALOG
= 'catalog'
HIDDEN
Product is invisible on both shop and search results, but can still be accessed directly.
public
mixed
HIDDEN
= 'hidden'
SEARCH
Product visible in the search results only.
public
mixed
SEARCH
= 'search'
VISIBLE
Product is visible on both shop and search results.
public
string
VISIBLE
= 'visible'
Methods
get_all()
Returns every catalog visibility value defined by this enum, as a flat list.
public
static get_all() : array<string|int, string>
These are the same four values wc_get_product_visibility_options() returns by default, which makes the two look interchangeable. They are not. That helper returns a value => label map, it is filterable, and WC_Product::set_catalog_visibility() validates against it, so a site can accept a visibility this list does not contain.
Use wc_get_product_visibility_options() wherever you validate or present a choice.
