WooCommerce Code Reference

ProductCollection extends AbstractBlock
in package

ProductCollection class.

Table of Contents

$asset_api  : Api
Instance of the asset API.
$asset_data_registry  : AssetDataRegistry
Instance of the asset data registry.
$attributes_filter_query_args  : array<string|int, mixed>
All the query args related to the filter by attributes block.
$block_name  : string
Block name.
$custom_order_opts  : array<string|int, mixed>
Orderby options not natively supported by WordPress REST API
$enqueued_assets  : bool
Tracks if assets have been enqueued.
$integration_registry  : IntegrationRegistry
Instance of the integration registry.
$namespace  : string
Block namespace.
$parsed_block  : array<string|int, mixed>
The Block with its attributes before it gets rendered
$valid_query_vars  : array<string|int, mixed>
All query args from WP_Query.
__construct()  : mixed
Constructor.
add_navigation_link_directives()  : mixed
Add interactive links to all anchors inside the Query Pagination block.
add_price_range_filter_posts_clauses()  : mixed
Add the `posts_clauses` filter to the main query.
add_support_for_filter_blocks()  : mixed
Add support for filter blocks: - Price filter block - Attributes filter block - Rating filter block - In stock filter block etc.
build_frontend_query()  : array<string|int, mixed>
Return a custom query based on attributes, filters and global WP_Query.
disable_enhanced_pagination()  : string
Check inner blocks of Product Collection block if there's one incompatible with Interactivity API and if so, disable client-side naviagtion.
enhance_product_collection_with_interactivity()  : string
Enhances the Product Collection block with client-side pagination.
enqueue_editor_assets()  : mixed
Enqueue assets used for rendering the block in editor context.
extend_rest_query_allowed_params()  : array<string|int, mixed>
Extends allowed `collection_params` for the REST API
get_price_range_query_args()  : array<string|int, mixed>
Get query arguments for price range filter.
render_callback()  : string
The default render_callback for all blocks. This will ensure assets are enqueued just in time, then render the block (if applicable).
update_rest_query_in_editor()  : array<string|int, mixed>
Update the query for the product query block in Editor.
adjust_price_filter_for_tax_class()  : float
Adjusts a price filter based on a tax class and whether or not the amount includes or excludes taxes.
append_product_sorting_table_join()  : string
Join wc_product_meta_lookup to posts if not already joined.
enqueue_data()  : mixed
Extra data passed through from server to client for block.
enqueue_scripts()  : mixed
Register/enqueue scripts used for this block on the frontend, during render.
get_block_type()  : string
Get the block type.
get_block_type_attributes()  : array<string|int, mixed>
Get block attributes.
get_block_type_editor_script()  : array<string|int, mixed>|string
Get the editor script data for this block type.
get_block_type_editor_style()  : string|null
Get the editor style handle for this block type.
get_block_type_render_callback()  : callable|null
Get the render callback for this block type.
get_block_type_script()  : array<string|int, mixed>|string|null
Get the frontend script handle for this block type.
get_block_type_style()  : array<string|int, string>|null
Get the frontend style handle for this block type.
get_block_type_supports()  : string
Get the supports array for this block type.
get_block_type_uses_context()  : array<string|int, mixed>
Get block usesContext.
get_chunks_paths()  : array<string|int, string>
Generate an array of chunks paths for loading translation.
get_full_block_name()  : string
Get the interactivity namespace. Only used when utilizing the interactivity API.
get_price_filter_query_for_displayed_taxes()  : string
Get query for price filters when dealing with displayed taxes.
get_routes_from_namespace()  : array<string|int, mixed>
Get routes from a REST API namespace.
initialize()  : mixed
Initialize this block type.
parse_render_callback_attributes()  : array<string|int, mixed>
Parses block attributes from the render_callback.
register_block_type()  : array<string|int, string>
Registers the block type with WordPress.
register_block_type_assets()  : mixed
Register script and style assets for the block type before it is registered.
register_chunk_translations()  : mixed
Injects Chunk Translations into the page so translations work for lazy loaded components.
render()  : string
Render the block. Extended by children.
array_merge_recursive_replace_non_array_properties()  : mixed
Merge two array recursively but replace the non-array values instead of merging them. The merging strategy:
filter_query_to_only_include_ids()  : array<string|int, mixed>
Apply the query only to a subset of products
get_custom_orderby_query()  : array<string|int, mixed>
Return query params to support custom sort values
get_date_query()  : array<string|int, mixed>
Constructs a date query for product filtering based on a specified time frame.
get_featured_query()  : array<string|int, mixed>
Generates a tax query to filter products based on their "featured" status.
get_filter_by_attributes_query()  : array<string|int, mixed>
Return a query that filters products by attributes.
get_filter_by_attributes_query_vars()  : array<string|int, mixed>
Get all the query args related to the filter by attributes block.
get_filter_by_price_query()  : array<string|int, mixed>
Return a query that filters products by price.
get_filter_by_rating_query()  : array<string|int, mixed>
Return a query that filters products by rating.
get_filter_by_stock_status_query()  : array<string|int, mixed>
Return a query that filters products by stock status.
get_filter_by_taxonomies_query()  : array<string|int, mixed>
Return a query to filter products by taxonomies (product categories, product tags, etc.)
get_final_frontend_query()  : mixed
Get the final query arguments for the frontend.
get_final_query_args()  : mixed
Get final query args based on provided values
get_on_sale_products_query()  : array<string|int, mixed>
Return a query for on sale products.
get_preview_query_args()  : mixed
Get query args for preview mode. These query args will be used with WP_Query to fetch the products.
get_product_attributes_query()  : array<string|int, mixed>
Return the `tax_query` for the requested attributes
get_product_visibility_query()  : array<string|int, mixed>
Return a query for product visibility depending on their stock status.
get_queries_by_applied_filters()  : array<string|int, mixed>
Return queries that are generated by query args.
get_stock_status_query()  : array<string|int, mixed>
Return a query for products depending on their stock status.
get_valid_query_vars()  : array<string|int, mixed>
Return or initialize $valid_query_vars.
is_block_compatible()  : bool
Verifies if the inner block is compatible with Interactivity API.
merge_queries()  : array<string|int, mixed>
Merge in the first parameter the keys "post_in", "meta_query" and "tax_query" of the second parameter.
merge_tax_queries()  : array<string|int, mixed>
Merge tax_queries from various queries.
process_pagination_links()  : string
Process pagination links within the block content.
should_adjust_price_range_for_taxes()  : bool
Determines if price filters need adjustment based on the tax display settings.
update_pagination_anchors()  : mixed
Sets up data attributes required for interactivity and client-side navigation.

Properties

$attributes_filter_query_args

All the query args related to the filter by attributes block.

protected array<string|int, mixed> $attributes_filter_query_args = array()

$custom_order_opts

Orderby options not natively supported by WordPress REST API

protected array<string|int, mixed> $custom_order_opts = array('popularity', 'rating')

Methods

__construct()

Constructor.

public __construct(Api $asset_api, AssetDataRegistry $asset_data_registry, IntegrationRegistry $integration_registry[, string $block_name = '' ]) : mixed
Parameters
$asset_api : Api

Instance of the asset API.

$asset_data_registry : AssetDataRegistry

Instance of the asset data registry.

$integration_registry : IntegrationRegistry

Instance of the integration registry.

$block_name : string = ''

Optionally set block name during construct.

Return values
mixed

Add interactive links to all anchors inside the Query Pagination block.

public add_navigation_link_directives(string $block_content, array<string|int, mixed> $block, WP_Block $instance) : mixed

This enabled client-side navigation for the product collection block.

Parameters
$block_content : string

The block content.

$block : array<string|int, mixed>

The full block, including name and attributes.

$instance : WP_Block

The block instance.

Return values
mixed

add_price_range_filter_posts_clauses()

Add the `posts_clauses` filter to the main query.

public add_price_range_filter_posts_clauses(array<string|int, mixed> $clauses, WP_Query $query) : mixed
Parameters
$clauses : array<string|int, mixed>

The query clauses.

$query : WP_Query

The WP_Query instance.

Return values
mixed

add_support_for_filter_blocks()

Add support for filter blocks: - Price filter block - Attributes filter block - Rating filter block - In stock filter block etc.

public add_support_for_filter_blocks(array<string|int, mixed> $pre_render, array<string|int, mixed> $parsed_block) : mixed
Parameters
$pre_render : array<string|int, mixed>

The pre-rendered block.

$parsed_block : array<string|int, mixed>

The parsed block.

Return values
mixed

build_frontend_query()

Return a custom query based on attributes, filters and global WP_Query.

public build_frontend_query(WP_Query $query, WP_Block $block, int $page) : array<string|int, mixed>
Parameters
$query : WP_Query

The WordPress Query.

$block : WP_Block

The block being rendered.

$page : int

The page number.

Return values
array<string|int, mixed>

disable_enhanced_pagination()

Check inner blocks of Product Collection block if there's one incompatible with Interactivity API and if so, disable client-side naviagtion.

public disable_enhanced_pagination(array<string|int, mixed> $parsed_block) : string
Parameters
$parsed_block : array<string|int, mixed>

The block being rendered.

Return values
stringReturns the parsed block, unmodified.

enhance_product_collection_with_interactivity()

Enhances the Product Collection block with client-side pagination.

public enhance_product_collection_with_interactivity(string $block_content, array<string|int, mixed> $block) : string

This function identifies Product Collection blocks and adds necessary data attributes to enable client-side navigation and animation effects. It also enqueues the Interactivity API runtime.

Parameters
$block_content : string

The HTML content of the block.

$block : array<string|int, mixed>

Block details, including its attributes.

Return values
stringUpdated block content with added interactivity attributes.

enqueue_editor_assets()

Enqueue assets used for rendering the block in editor context.

public enqueue_editor_assets() : mixed

This is needed if a block is not yet within the post content--render and enqueue_assets may not have ran.

Return values
mixed

extend_rest_query_allowed_params()

Extends allowed `collection_params` for the REST API

public extend_rest_query_allowed_params(array<string|int, mixed> $params) : array<string|int, mixed>

By itself, the REST API doesn't accept custom orderby values, even if they are supported by a custom post type.

Parameters
$params : array<string|int, mixed>

A list of allowed orderby values.

Return values
array<string|int, mixed>

get_price_range_query_args()

Get query arguments for price range filter.

public get_price_range_query_args(array<string|int, mixed> $price_range) : array<string|int, mixed>

We are adding these extra query arguments to be used in posts_clauses because there are 2 special edge cases we wanna handle for Price range filter: Case 1: Prices excluding tax are displayed including tax Case 2: Prices including tax are displayed excluding tax

Both of these cases require us to modify SQL query to get the correct results.

See add_price_range_filter_posts_clauses function in this file for more details.

Parameters
$price_range : array<string|int, mixed>

Price range with min and max values.

Return values
array<string|int, mixed>Query arguments.

render_callback()

The default render_callback for all blocks. This will ensure assets are enqueued just in time, then render the block (if applicable).

public render_callback([array<string|int, mixed>|WP_Block $attributes = [] ][, string $content = '' ][, WP_Block|null $block = null ]) : string
Parameters
$attributes : array<string|int, mixed>|WP_Block = []

Block attributes, or an instance of a WP_Block. Defaults to an empty array.

$content : string = ''

Block content. Default empty string.

$block : WP_Block|null = null

Block instance.

Return values
stringRendered block type output.

update_rest_query_in_editor()

Update the query for the product query block in Editor.

public update_rest_query_in_editor(array<string|int, mixed> $args, WP_REST_Request $request) : array<string|int, mixed>
Parameters
$args : array<string|int, mixed>

Query args.

$request : WP_REST_Request

Request.

Return values
array<string|int, mixed>

adjust_price_filter_for_tax_class()

Adjusts a price filter based on a tax class and whether or not the amount includes or excludes taxes.

protected adjust_price_filter_for_tax_class(float $price_filter, string $tax_class) : float

This calculation logic is based on wc_get_price_excluding_tax and wc_get_price_including_tax in core.

Parameters
$price_filter : float

Price filter amount as entered.

$tax_class : string

Tax class for adjustment.

Return values
float

append_product_sorting_table_join()

Join wc_product_meta_lookup to posts if not already joined.

protected append_product_sorting_table_join(string $sql) : string
Parameters
$sql : string

SQL join.

Return values
string

enqueue_data()

Extra data passed through from server to client for block.

protected enqueue_data([array<string|int, mixed> $attributes = array() ]) : mixed
Parameters
$attributes : array<string|int, mixed> = array()

Any attributes that currently are available from the block. Note, this will be empty in the editor context when the block is not in the post content on editor load.

Return values
mixed

enqueue_scripts()

Register/enqueue scripts used for this block on the frontend, during render.

protected enqueue_scripts([array<string|int, mixed> $attributes = [] ]) : mixed
Parameters
$attributes : array<string|int, mixed> = []

Any attributes that currently are available from the block.

Return values
mixed

get_block_type_attributes()

Get block attributes.

protected get_block_type_attributes() : array<string|int, mixed>
Return values
array<string|int, mixed>

get_block_type_editor_script()

Get the editor script data for this block type.

protected get_block_type_editor_script([string $key = null ]) : array<string|int, mixed>|string
Parameters
$key : string = null

Data to get, or default to everything.

Tags
see

$this->register_block_type()

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

get_block_type_editor_style()

Get the editor style handle for this block type.

protected get_block_type_editor_style() : string|null
Tags
see

$this->register_block_type()

Return values
string|null

get_block_type_render_callback()

Get the render callback for this block type.

protected get_block_type_render_callback() : callable|null

Dynamic blocks should return a callback, for example, return [ $this, 'render' ];

Tags
see

$this->register_block_type()

Return values
callable|null

get_block_type_script()

Get the frontend script handle for this block type.

protected get_block_type_script([string $key = null ]) : array<string|int, mixed>|string|null
Parameters
$key : string = null

Data to get, or default to everything.

Tags
see

$this->register_block_type()

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

get_block_type_style()

Get the frontend style handle for this block type.

protected get_block_type_style() : array<string|int, string>|null
Return values
array<string|int, string>|null

get_block_type_supports()

Get the supports array for this block type.

protected get_block_type_supports() : string
Tags
see

$this->register_block_type()

Return values
string

get_block_type_uses_context()

Get block usesContext.

protected get_block_type_uses_context() : array<string|int, mixed>
Return values
array<string|int, mixed>

get_chunks_paths()

Generate an array of chunks paths for loading translation.

protected get_chunks_paths(string $chunks_folder) : array<string|int, string>
Parameters
$chunks_folder : string

The folder to iterate over.

Return values
array<string|int, string>$chunks list of chunks to load.

get_full_block_name()

Get the interactivity namespace. Only used when utilizing the interactivity API.

protected get_full_block_name() : string
Return values
stringThe interactivity namespace, used to namespace interactivity API actions and state.

get_price_filter_query_for_displayed_taxes()

Get query for price filters when dealing with displayed taxes.

protected get_price_filter_query_for_displayed_taxes(float $price_filter[, string $column = 'min_price' ][, string $operator = '>=' ]) : string
Parameters
$price_filter : float

Price filter to apply.

$column : string = 'min_price'

Price being filtered (min or max).

$operator : string = '>='

Comparison operator for column.

Return values
stringConstructed query.

get_routes_from_namespace()

Get routes from a REST API namespace.

protected get_routes_from_namespace(string $namespace) : array<string|int, mixed>
Parameters
$namespace : string

Namespace to retrieve.

Return values
array<string|int, mixed>

initialize()

Initialize this block type.

protected initialize() : mixed
  • Hook into WP lifecycle.
  • Register the block with WordPress.
  • Hook into pre_render_block to update the query.
Return values
mixed

parse_render_callback_attributes()

Parses block attributes from the render_callback.

protected parse_render_callback_attributes(array<string|int, mixed>|WP_Block $attributes) : array<string|int, mixed>
Parameters
$attributes : array<string|int, mixed>|WP_Block

Block attributes, or an instance of a WP_Block. Defaults to an empty array.

Return values
array<string|int, mixed>

register_block_type()

Registers the block type with WordPress.

protected register_block_type() : array<string|int, string>
Return values
array<string|int, string>Chunks paths.

register_block_type_assets()

Register script and style assets for the block type before it is registered.

protected register_block_type_assets() : mixed

This registers the scripts; it does not enqueue them.

Return values
mixed

register_chunk_translations()

Injects Chunk Translations into the page so translations work for lazy loaded components.

protected register_chunk_translations(array<string|int, string> $chunks) : mixed

The chunk names are defined when creating lazy loaded components using webpackChunkName.

Parameters
$chunks : array<string|int, string>

Array of chunk names.

Return values
mixed

render()

Render the block. Extended by children.

protected render(array<string|int, mixed> $attributes, string $content, WP_Block $block) : string
Parameters
$attributes : array<string|int, mixed>

Block attributes.

$content : string

Block content.

$block : WP_Block

Block instance.

Return values
stringRendered block type output.

array_merge_recursive_replace_non_array_properties()

Merge two array recursively but replace the non-array values instead of merging them. The merging strategy:

private array_merge_recursive_replace_non_array_properties(array<string|int, mixed> $base, array<string|int, mixed> $new) : mixed
  • If keys from merge array doesn't exist in the base array, create them.

  • For array items with numeric keys, we merge them as normal.

  • For array items with string keys:

    • If the value isn't array, we'll use the value comming from the merge array. $base = ['orderby' => 'date'] $new = ['orderby' => 'meta_value_num'] Result: ['orderby' => 'meta_value_num']

    • If the value is array, we'll use recursion to merge each key. $base = ['meta_query' => [ [ 'key' => '_stock_status', 'compare' => 'IN' 'value' => ['instock', 'onbackorder'] ] ]] $new = ['meta_query' => [ [ 'relation' => 'AND', [...<max_price_query>], [...<min_price_query>], ] ]] Result: ['meta_query' => [ [ 'key' => '_stock_status', 'compare' => 'IN' 'value' => ['instock', 'onbackorder'] ], [ 'relation' => 'AND', [...<max_price_query>], [...<min_price_query>], ] ]]

      $base = ['post__in' => [1, 2, 3, 4, 5]] $new = ['post__in' => [3, 4, 5, 6, 7]] Result: ['post__in' => [1, 2, 3, 4, 5, 3, 4, 5, 6, 7]]

Parameters
$base : array<string|int, mixed>

First array.

$new : array<string|int, mixed>

Second array.

Return values
mixed

filter_query_to_only_include_ids()

Apply the query only to a subset of products

private filter_query_to_only_include_ids(array<string|int, mixed> $query, array<string|int, mixed> $ids) : array<string|int, mixed>
Parameters
$query : array<string|int, mixed>

The query.

$ids : array<string|int, mixed>

Array of selected product ids.

Return values
array<string|int, mixed>

get_custom_orderby_query()

Return query params to support custom sort values

private get_custom_orderby_query(string $orderby) : array<string|int, mixed>
Parameters
$orderby : string

Sort order option.

Return values
array<string|int, mixed>

get_date_query()

Constructs a date query for product filtering based on a specified time frame.

private get_date_query(array<string|int, mixed> $time_frame) : array<string|int, mixed>
Parameters
$time_frame : array<string|int, mixed>

{ Associative array with 'operator' (in or not-in) and 'value' (date string).

@type string $operator Determines the inclusion or exclusion of the date range.
@type string $value    The date around which the range is applied.

}

Return values
array<string|int, mixed>Date query array; empty if parameters are invalid.

Generates a tax query to filter products based on their "featured" status.

private get_featured_query(bool $featured) : array<string|int, mixed>

If the $featured parameter is true, the function will return a tax query that filters products to only those marked as featured. If $featured is false, an empty array is returned, meaning no filtering will be applied.

Parameters
$featured : bool

A flag indicating whether to filter products based on featured status.

Return values
array<string|int, mixed>A tax query for fetching featured products if `$featured` is true; otherwise, an empty array.

get_filter_by_attributes_query()

Return a query that filters products by attributes.

private get_filter_by_attributes_query() : array<string|int, mixed>
Return values
array<string|int, mixed>

get_filter_by_attributes_query_vars()

Get all the query args related to the filter by attributes block.

private get_filter_by_attributes_query_vars() : array<string|int, mixed>
Return values
array<string|int, mixed>[color] => Array ( [filter] => filter_color [query_type] => query_type_color ) [size] => Array ( [filter] => filter_size [query_type] => query_type_size ) )

get_filter_by_price_query()

Return a query that filters products by price.

private get_filter_by_price_query() : array<string|int, mixed>
Return values
array<string|int, mixed>

get_filter_by_rating_query()

Return a query that filters products by rating.

private get_filter_by_rating_query() : array<string|int, mixed>
Return values
array<string|int, mixed>

get_filter_by_stock_status_query()

Return a query that filters products by stock status.

private get_filter_by_stock_status_query() : array<string|int, mixed>
Return values
array<string|int, mixed>

get_filter_by_taxonomies_query()

Return a query to filter products by taxonomies (product categories, product tags, etc.)

private get_filter_by_taxonomies_query(array<string|int, mixed> $tax_query) : array<string|int, mixed>

For example: User could provide "Product Categories" using "Filters" ToolsPanel available in Inspector Controls. We use this function to extract its query from $tax_query.

For example, this is how the query for product categories will look like in $tax_query array: Array ( [taxonomy] => product_cat [terms] => Array ( [0] => 36 ) )

For product tags, taxonomy would be "product_tag"

Parameters
$tax_query : array<string|int, mixed>

Query to filter products by taxonomies.

Return values
array<string|int, mixed>Query to filter products by taxonomies.

get_final_frontend_query()

Get the final query arguments for the frontend.

private get_final_frontend_query(array<string|int, mixed> $query[, int $page = 1 ][, bool $is_exclude_applied_filters = false ]) : mixed
Parameters
$query : array<string|int, mixed>

The query arguments.

$page : int = 1

The page number.

$is_exclude_applied_filters : bool = false

Whether to exclude the applied filters or not.

Return values
mixed

get_final_query_args()

Get final query args based on provided values

private get_final_query_args(array<string|int, mixed> $common_query_values, array<string|int, mixed> $query[, bool $is_exclude_applied_filters = false ]) : mixed
Parameters
$common_query_values : array<string|int, mixed>

Common query values.

$query : array<string|int, mixed>

Query from block context.

$is_exclude_applied_filters : bool = false

Whether to exclude the applied filters or not.

Return values
mixed

get_on_sale_products_query()

Return a query for on sale products.

private get_on_sale_products_query(bool $is_on_sale) : array<string|int, mixed>
Parameters
$is_on_sale : bool

Whether to query for on sale products.

Return values
array<string|int, mixed>

get_preview_query_args()

Get query args for preview mode. These query args will be used with WP_Query to fetch the products.

private get_preview_query_args(array<string|int, mixed> $args, WP_REST_Request $request) : mixed
Parameters
$args : array<string|int, mixed>

Query args.

$request : WP_REST_Request

Request.

Return values
mixed

get_product_attributes_query()

Return the `tax_query` for the requested attributes

private get_product_attributes_query([array<string|int, mixed> $attributes = array() ]) : array<string|int, mixed>
Parameters
$attributes : array<string|int, mixed> = array()

Attributes and their terms.

Return values
array<string|int, mixed>

get_product_visibility_query()

Return a query for product visibility depending on their stock status.

private get_product_visibility_query(array<string|int, mixed> $stock_query, array<string|int, mixed> $stock_status) : array<string|int, mixed>
Parameters
$stock_query : array<string|int, mixed>

Stock status query.

$stock_status : array<string|int, mixed>

Selected stock status.

Return values
array<string|int, mixed>Tax query for product visibility.

get_queries_by_applied_filters()

Return queries that are generated by query args.

private get_queries_by_applied_filters() : array<string|int, mixed>
Return values
array<string|int, mixed>

get_stock_status_query()

Return a query for products depending on their stock status.

private get_stock_status_query(array<string|int, mixed> $stock_statuses) : array<string|int, mixed>
Parameters
$stock_statuses : array<string|int, mixed>

An array of acceptable stock statuses.

Return values
array<string|int, mixed>

get_valid_query_vars()

Return or initialize $valid_query_vars.

private get_valid_query_vars() : array<string|int, mixed>
Return values
array<string|int, mixed>

is_block_compatible()

Verifies if the inner block is compatible with Interactivity API.

private is_block_compatible(string $block_name) : bool
Parameters
$block_name : string

Name of the block to verify.

Return values
bool

merge_queries()

Merge in the first parameter the keys "post_in", "meta_query" and "tax_query" of the second parameter.

private merge_queries(array<string|int, array<string|int, mixed>> ...$queries) : array<string|int, mixed>
Parameters
$queries : array<string|int, array<string|int, mixed>>

Query arrays to be merged.

Return values
array<string|int, mixed>

merge_tax_queries()

Merge tax_queries from various queries.

private merge_tax_queries(array<string|int, mixed> ...$queries) : array<string|int, mixed>
Parameters
$queries : array<string|int, mixed>

Query arrays to be merged.

Return values
array<string|int, mixed>

Process pagination links within the block content.

private process_pagination_links(string $block_content) : string
Parameters
$block_content : string

The block content.

Return values
stringThe updated block content.

should_adjust_price_range_for_taxes()

Determines if price filters need adjustment based on the tax display settings.

private should_adjust_price_range_for_taxes() : bool

This function checks if there's a discrepancy between how prices are stored in the database and how they are displayed to the user, specifically with respect to tax inclusion or exclusion. It returns true if an adjustment is needed, indicating that the price filters should account for this discrepancy to display accurate prices.

Return values
boolTrue if the price filters need to be adjusted for tax display settings, false otherwise.

update_pagination_anchors()

Sets up data attributes required for interactivity and client-side navigation.

private update_pagination_anchors(WP_HTML_Tag_Processor $processor, string $class_name, string $key_prefix) : mixed
Parameters
$processor : WP_HTML_Tag_Processor

The HTML tag processor.

$class_name : string

The class name of the anchor tags.

$key_prefix : string

The prefix for the data-wc-key attribute.

Return values
mixed