Filter_Can_Index_Taxonomy

Provides access to methods that can be used to index a taxonomy from a product.

Tags
author

Barn2 Plugins support@barn2.com

license

GPL-3.0

copyright

Barn2 Media Ltd

Table of Contents

filter_visible_terms()  : array<string|int, mixed>
Filter the list of terms to only include the ones that are used as variations for the current product.
get_indexable_taxonomy_data()  : array<string|int, mixed>
Generate taxonomy index data.
get_indexed_terms()  : array<string|int, mixed>
Get indexed terms for this filter type.
get_specific_terms()  : array<string|int, mixed>
Get the specific terms for the filter.
get_terms_from_attribute()  : array<string|int, mixed>|false
Get the terms from the product's attributes.
is_restricted_to_specific_terms()  : bool
Determine if the filter is restricted to specific terms.

Methods

filter_visible_terms()

Filter the list of terms to only include the ones that are used as variations for the current product.

public static filter_visible_terms(array<string|int, mixed> $terms, WC_Product $product) : array<string|int, mixed>
Parameters
$terms : array<string|int, mixed>
$product : WC_Product
Return values
array<string|int, mixed>

get_indexable_taxonomy_data()

Generate taxonomy index data.

public get_indexable_taxonomy_data(array<string|int, mixed> $defaults, string $post_id, string $taxonomy) : array<string|int, mixed>
Parameters
$defaults : array<string|int, mixed>

the default index data.

$post_id : string

the post ID.

$taxonomy : string

the taxonomy slug.

Return values
array<string|int, mixed>

get_indexed_terms()

Get indexed terms for this filter type.

public get_indexed_terms([array<string|int, mixed> $posts = [] ]) : array<string|int, mixed>
Parameters
$posts : array<string|int, mixed> = []

The posts to look up. When empty, all values will be returned.

Return values
array<string|int, mixed>

get_specific_terms()

Get the specific terms for the filter.

public get_specific_terms() : array<string|int, mixed>

This method returns an array of term IDs.

Return values
array<string|int, mixed>

get_terms_from_attribute()

Get the terms from the product's attributes.

public get_terms_from_attribute(int $variation_id, string $taxonomy) : array<string|int, mixed>|false
Parameters
$variation_id : int

the variation ID.

$taxonomy : string

the taxonomy slug.

Return values
array<string|int, mixed>|false

is_restricted_to_specific_terms()

Determine if the filter is restricted to specific terms.

public is_restricted_to_specific_terms() : bool
Return values
bool

Search results