Title: Problem after reload page
Last modified: October 12, 2022

---

# Problem after reload page

 *  Resolved [nordrium](https://wordpress.org/support/users/nordrium/)
 * (@nordrium)
 * [3 years, 8 months ago](https://wordpress.org/support/topic/problem-after-reload-page/)
 * Hello!
    I use your wonderful filter, but there is one problem. I am developing
   a theme for a website, for personal use, I wrote the code to determine what is
   displayed on the page, products or subcategories. Also, I use the condition of
   which template to display, depending on what is displayed on the page. And what’s
   the problem. After I select something in the filter and if I reload the page,
   an “Undefined variable $term” error appears Can you suggest how this can be fixed?
   I will provide code examples.
 * Code to determine what is “on the screen” in functions.php
 *     ```
       function is_product_list_display_type( $term ) {
       	$taxonomy = 'product_cat';
       	if( ! term_exists( $term, $taxonomy ) )
       	return false;
       	if( ! is_numeric( $term ) )
       	$term = get_term_by( 'slug', sanitize_title( $term ), $taxonomy )->term_id;
       return get_term_meta( $term, 'display_type', true ) === 'products' ?  true : false;
       }
       ```
   
 * Condition for choosing a template in taxonomy-produc-cat.php
 *     ```
       if(is_product_list_display_type( $term )){
       wc_get_template( 'archive-product-custom.php' ); 
       } elseif (is_subcategory_display_type( $term )) {
       	wc_get_template( 'archive-product-category.php' ); 
       } else {
       	wc_get_template( 'archive-product.php' );
       }
       ```
   
 * Thanks you for help!

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Author [WBW Plugins](https://wordpress.org/support/users/woobewoo/)
 * (@woobewoo)
 * [3 years, 8 months ago](https://wordpress.org/support/topic/problem-after-reload-page/#post-16099293)
 * Hello [@nordrium](https://wordpress.org/support/users/nordrium/),
 * Please contact our internal support team.
    We need more details on this issue.
 * [https://woobewoo.com/contact-us/](https://woobewoo.com/contact-us/)
 *  Thread Starter [nordrium](https://wordpress.org/support/users/nordrium/)
 * (@nordrium)
 * [3 years, 8 months ago](https://wordpress.org/support/topic/problem-after-reload-page/#post-16099426)
 * Don’t worry, after enabling “Force theme templates”, the error is gone!

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Problem after reload page’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/woo-product-filter_a0a6df.svg)
 * [Product Filter for WooCommerce by WBW](https://wordpress.org/plugins/woo-product-filter/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/woo-product-filter/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/woo-product-filter/)
 * [Active Topics](https://wordpress.org/support/plugin/woo-product-filter/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woo-product-filter/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woo-product-filter/reviews/)

## Tags

 * [filter](https://wordpress.org/support/topic-tag/filter/)
 * [product filter](https://wordpress.org/support/topic-tag/product-filter/)
 * [shop filter](https://wordpress.org/support/topic-tag/shop-filter/)

 * 2 replies
 * 2 participants
 * Last reply from: [nordrium](https://wordpress.org/support/users/nordrium/)
 * Last activity: [3 years, 8 months ago](https://wordpress.org/support/topic/problem-after-reload-page/#post-16099426)
 * Status: resolved