1. Home
  2. WooCommerce Product Filters
  3. Developer Documentation

WooCommerce Product Filters Action and Filters

WooCommerce Product Filters contains a number of hooks that you can use to customize the plugin's behavior.

Please note that this code is aimed at developers and if you don't know how to use it then you should ask your developer. If you don't have one, we recommend posting a job on Codeable. We have partnered with them to provide plugin customizations for our customers.

We've partnered with Codeable to provide our customers with expert help if required.

Filters

wcf_pricing_api_products_ids

Filter that allows adjustments to the list of product ids used to retrieve
that max price for the pricing slider filter on taxonomy pages.

Arguments

  • $products (array): The list of products ids.

add_filter( 'wcf_pricing_api_products_ids', 'my_wcf_pricing_api_products_ids' );

function my_wcf_pricing_api_products_ids( $products_ids ) {
    // Do something with the $products_ids array
    return $products_ids;
}

wcf_horizontal_minimum_images

Filter that allows adjustments to the amount of images displayed inside the "image" filter when used within an horizontal filter group.

Arguments

  • $amount (int): The amount.

add_filter( 'wcf_horizontal_minimum_images', 'my_wcf_horizontal_minimum_images' );

function my_wcf_horizontal_minimum_images( $amount ) {
    return 3;
}

wcf_is_pagination_disabled

Filter: allows third parties to disable the custom pagination template if needed.

Arguments

  • $disabled (bool): Whether the pagination is disabled or not.

add_filter( 'wcf_is_pagination_disabled', 'my_wcf_is_pagination_disabled' );

function my_wcf_is_pagination_disabled( $disabled ) {
    return true;
}

wcf_dropdowns_searchable_mobile

Filter: allows third parties to disable the searchable dropdowns on mobile.

Arguments

  • $searchable (bool): Whether the searchable dropdowns are enabled or not.

add_filter( 'wcf_dropdowns_searchable_mobile', 'my_wcf_dropdowns_searchable_mobile' );

function my_wcf_dropdowns_searchable_mobile( $searchable ) {
    return false;
}

wcf_design_settings

Filter: allows third parties to add their own design settings or modify the existing ones.

Arguments

  • $settings (array): The design settings.

add_filter( 'wcf_design_settings', 'my_wcf_design_settings' );

function my_wcf_design_settings( $settings ) {
    // Do something here.

    return $settings;
}

wcf_batch_index_chunk_size

Allows developers to change the amount of posts processed with each batch during indexing. Default is 30.

Arguments

  • $chunk_size (int): The amount of posts processed with each batch.

add_filter( 'wcf_batch_index_chunk_size', 'my_wcf_batch_index_chunk_size' );

function my_wcf_batch_index_chunk_size( $chunk_size ) {
    return 50;
}

wcf_indexer_skip_hidden_products

Allows developers to skip hidden products during indexing. Default is true.

Arguments

  • $skip (bool): Whether to skip hidden products or not.

add_filter( 'wcf_indexer_skip_hidden_products', 'my_wcf_indexer_skip_hidden_products' );

function my_wcf_indexer_skip_hidden_products( $skip ) {
    return false;
}

wcf_index_row

Allows developers to bypass the row insertion by returning anything else other than an array.

Arguments

  • $params (array): indexed data for the filter
  • $indexer (Indexer): The instance of the indexer

add_filter( 'wcf_index_row', 'my_wcf_index_row', 10, 2 );

function my_wcf_index_row( $params, $indexer ) {
    // Do something here.

    return $params;
}

wcf_taxonomy_filter_attribute_terms_list

Allows developers to modify the list of found terms generated by the Attribute filter type.

Arguments

  • $terms (array): The list of found terms.
  • $filter (Filter): The instance of the filter.

add_filter( 'wcf_taxonomy_filter_attribute_terms_list', 'my_wcf_taxonomy_filter_attribute_terms_list', 10, 2 );

function my_wcf_taxonomy_filter_attribute_terms_list( $terms, $filter ) {
    // Do something here.

    return $terms;
}

wcf_taxonomy_json_terms_args

Allows modification of the arguments used to retrieve terms for the images taxonomy filter.

Arguments

  • $args (array): The arguments used to retrieve terms.
  • $filter (Filter): The instance of the filter.

add_filter( 'wcf_taxonomy_json_terms_args', 'my_wcf_taxonomy_json_terms_args', 10, 2 );

function my_wcf_taxonomy_json_terms_args( $args, $filter ) {
    // Do something here.

    return $args;
}

wcf_taxonomy_filter_terms_list

Allows developers to modify the list of found terms generated by the Taxonomy filter type.

Arguments

  • $terms (array): The list of found terms.
  • $filter (Filter): The instance of the filter.

add_filter( 'wcf_taxonomy_filter_terms_list', 'my_wcf_taxonomy_filter_terms_list', 10, 2 );

function my_wcf_taxonomy_filter_terms_list( $terms, $filter ) {
    // Do something here.

    return $terms;
}

wcf_results_count

Allows developers to adjust the arguments used to generate the WooCommerce result-count template output.

Arguments

  • $args (array): The arguments used to generate the WooCommerce result-count template output.
  • $query (bool|\WP_Query): Optional wp query instance that might be sent through in some cases.
  • $post_ids (array): List of post ids that might be sent through in some cases.
  • $filters (null|Collection): List of filters possibly sent through during request.

add_filter( 'wcf_results_count', 'my_wcf_results_count', 10, 4 );

function my_wcf_results_count( $args, $query, $post_ids, $filters ) {
    // Do something here.

    return $args;
}

wcf_is_main_query

Allows developers to adjust the conditions used to determine whether or not the query being processed is a WCF main query.

Arguments

  • $is_main_query (bool): Whether the query is a WCF main query or not.
  • $query (bool|\WP_Query): Optional wp query instance that might be sent through in some cases.

add_filter( 'wcf_is_main_query', 'my_wcf_is_main_query', 10, 2 );

function my_wcf_is_main_query( $is_main_query, $query ) {
    // Do something here.

    return $is_main_query;
}

wcf_filtered_post_ids

Allows developers to adjust the array of retrieved products after it has queried the database and found the appropriate results.

Arguments

  • $post_ids (array): The list of post ids.
  • $filters (null|Collection): List of filters possibly sent through during request.

add_filter( 'wcf_filtered_post_ids', 'my_wcf_filtered_post_ids', 10, 3 );

function my_wcf_filtered_post_ids( $post_ids, $filters ) {
    // Do something here.

    return $post_ids;
}

wcf_taxonomy_filter_ranged_terms_list

Allows developers to modify the list of found terms generated by the Ranged Attribute filter type.

Arguments

  • $output (array): The list of found terms.
  • $taxonomy (string): The taxonomy slug.
  • $terms (array): The original list of terms.
  • $post_id (string|int): The post id.

Actions

wcf_after_product_save

Hook into the `save_post` WP hook but after we've executed our custom logic that indexes products.

Arguments

  • $post_id (int): The post id.
  • $product (object): WC instance of a product.

add_action( 'wcf_after_product_save', 'my_wcf_after_product_save', 10, 2 );

function my_wcf_after_product_save( $post_id, $product ) {
    // Do something here.
}

wcf_after_product_import

Hook into the csv import process, fires after the product has been imported & indexed.

Arguments

  • $product (object): WC instance of a product.

add_action( 'wcf_after_product_import', 'my_wcf_after_product_import', 10, 1 );

function my_wcf_after_product_import( $product ) {
    // Do something here.
}

wcf_after_product_delete

Hook into the product delete process and after the index has been cleared of data related to the product that has been deleted.

Arguments

  • $post_id (int): The post id.

add_action( 'wcf_after_product_delete', 'my_wcf_after_product_delete', 10, 1 );

function my_wcf_after_product_delete( $post_id ) {
    // Do something here.
}

wcf_indexer_complete

Hook into the indexer completion process.


add_action( 'wcf_indexer_complete', 'my_wcf_indexer_complete' );

function my_wcf_indexer_complete() {
    // Do something here.
}

wcf_batch_index_complete

Allow developers to hook into the batch indexing process once a batch is complete.

Arguments

  • $post_ids (array): List of posts that were processed.
  • $offset (string|int): wp query offeset processed.
  • $limit (string|int): batch amount processed..

add_action( 'wcf_batch_index_complete', 'my_wcf_batch_index_complete', 10, 3 );

function my_wcf_batch_index_complete( $post_ids, $offset, $limit ) {
    // Do something here.
}

wcf_after_product_index

Hook into the indexing process after a product has been indexed.

Arguments

  • $post_id (int): The post id.
  • $product (object): WC instance of a product.
  • $filters (Collection): List of filters possibly sent through during request.
  • $indexer (Indexer): The instance of the indexer.

add_action( 'wcf_after_product_index', 'my_wcf_after_product_index', 10, 4 );

function my_wcf_after_product_index( $post_id, $product, $filters, $indexer ) {
    // Do something here.
}

Related Articles

If searching the knowledge base hasn't answered your question, please contact support.