Support » Plugin: WC Ajax Product Filter » Filter by Product Tag

Viewing 1 replies (of 1 total)
  • Hi!

    I had the same problem and I fix it by myself. It’s weird, because the plugin is ready but the functionality is not enabled.

    First of all, check if in your wc-ajax-product-filter\widgets folder you have a file named “widget-tag-filter.php”. Else, clone the “widget-category-filter.php” and modify every “category” text by “tag”, being careful of maintaining the caps. Also, every “tag” suffix text by “tag”. Example: product_cat, product-cata, product-cato by product_tag, product-taga, product-tago

    Next, in the “wcapf.php” file go around the line 127, inside the “includes()” function and add:

    require_once 'widgets/widget-tag-filter.php';

    Last, in the same “wcapf.php” file go around the line 313. You will si a comment text like “// category” and after of that a piece of code inside of an “if”. Copy this piece of code and paste after the “category” piece. Change the comment if you want by “// Tag” and in the first lines you have to change “product-cat” (2 times) and “product-cata” by “product-tag” and “product-taga”, respectively.

    This is it:

    // tag
    if (preg_match('/product-tag/', $key) && !empty($query[$key])) {
       $terms = explode(',', $value);
       $taxonomy = 'product_tag';
       if (preg_match('/^product-taga/', $key)) {
          $query_type = 'and';
       } else {
          $query_type = 'or';
       $chosen[$taxonomy] = array(
          'terms'      => $terms,
          'query_type' => $query_type
       foreach ($terms as $term_id) {
          $ancestors = wcapf_get_term_ancestors($term_id, $taxonomy);
          $term_data = wcapf_get_term_data($term_id, $taxonomy);
          $term_ancestors[$key][] = $ancestors;
          $active_filters['term'][$key][$term_id] = $term_data->name;

    Please, let me know if it’s working for you.

    Best regards.

Viewing 1 replies (of 1 total)
  • The topic ‘Filter by Product Tag’ is closed to new replies.