Skip to content

Developer notes

Hook Purpose
get_products Adds AND logic and picked categories to the search
get_filters_products_count_pre Adds kvpf_cats to the cache key of the counts
get_filters_products_count_post Adds styles, images, AND state and the category filter
delete_product_filter_post Removes the row of a deleted filter
dispatch_before_display Tells storefront templates that the add-on is on

All exist with the same arguments in 4.17.2 and 4.21.2.

hooks/blocks/product_filters_variants_element.override.tpl renders the category list, drop-down and tiles. It stays empty for other filters, so core renders those. The drop-down keeps hidden core checkboxes, so core builds the same features_hash.

func.js listens for change on body, which runs before the core handler on document, and stops the event. Apply builds the hash the same way as core and calls $.ceAjax.

Core joins scripts, so the settings printed in the page can run after func.js. It reads Tygh.kvPfp on use.

schemas/block_manager/blocks.post.php adds kvpf_cats to the request of the filter block, and to disable_cache_when wherever core has features_hash there. Without that the cached main block would show the list of another selection.

The output depends on the URL only, and there is no per-visitor output. Picked categories are in the address, like features_hash. This was reviewed in code, not tested on a store with the full page cache on.

?:kv_pfp_filters: filter_id, style, logic. A filter with default values has no row.

Filters::isOn() is checked in each search and when filters are read. The storefront script loads only when it is true.