Products
Utility methods for products.
Table of Contents
- get_catalog_sorting_options() : array<string|int, mixed>
- Returns the list of sorting options.
- get_currency_data() : array<string|int, mixed>
- Get currency data about the store.
- get_registered_attributes() : array<string|int, mixed>
- Get the list of all global attributes taxonomies.
- get_registered_taxonomies() : array<string|int, mixed>
- Get a list of registered taxonomies for products excluding a certain subset.
- get_string_between() : string
- Get a substring between two strings.
- is_product_attribute_page() : bool
- Determine if we're visiting a product attribute page.
Methods
get_catalog_sorting_options()
Returns the list of sorting options.
public
static get_catalog_sorting_options() : array<string|int, mixed>
Return values
array<string|int, mixed> —get_currency_data()
Get currency data about the store.
public
static get_currency_data() : array<string|int, mixed>
Return values
array<string|int, mixed> —get_registered_attributes()
Get the list of all global attributes taxonomies.
public
static get_registered_attributes([bool $with_prefix = false ]) : array<string|int, mixed>
Parameters
- $with_prefix : bool = false
-
whether we need the "pa_" prefix in front of the name.
Return values
array<string|int, mixed> —get_registered_taxonomies()
Get a list of registered taxonomies for products excluding a certain subset.
public
static get_registered_taxonomies([bool $exclude_default = false ][, bool $with_attributes = false ]) : array<string|int, mixed>
Parameters
- $exclude_default : bool = false
-
when true, it will exclude categories and tags too.
- $with_attributes : bool = false
-
when true, it will include attributes too.
Return values
array<string|int, mixed> —get_string_between()
Get a substring between two strings.
public
static get_string_between(string $string, string $start, string $end) : string
Parameters
- $string : string
- $start : string
- $end : string
Return values
string —is_product_attribute_page()
Determine if we're visiting a product attribute page.
public
static is_product_attribute_page() : bool