Title: Reload page problem
Last modified: October 12, 2022

---

# Reload page problem

 *  Resolved [nordrium](https://wordpress.org/support/users/nordrium/)
 * (@nordrium)
 * [3 years, 8 months ago](https://wordpress.org/support/topic/reload-page-problem/)
 * 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!
    -  This topic was modified 3 years, 8 months ago by [nordrium](https://wordpress.org/support/users/nordrium/).

Viewing 1 replies (of 1 total)

 *  Plugin Support [mediawebster](https://wordpress.org/support/users/mediawebster/)
 * (@mediawebster)
 * [3 years, 8 months ago](https://wordpress.org/support/topic/reload-page-problem/#post-16099234)
 * Hello
 * It means you don’t have such a variable. Unfortunately I don’t know from where
   you take the $term.
 * If it is an object of the current archive – try in Advanced->Options-https://
   c2n.me/4gRVvjf.png

Viewing 1 replies (of 1 total)

The topic ‘Reload page problem’ is closed to new replies.

 * ![](https://ps.w.org/woocommerce-products-filter/assets/icon-256x256.png?rev=
   2844301)
 * [HUSKY - Products Filter Professional for WooCommerce](https://wordpress.org/plugins/woocommerce-products-filter/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/woocommerce-products-filter/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/woocommerce-products-filter/)
 * [Active Topics](https://wordpress.org/support/plugin/woocommerce-products-filter/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woocommerce-products-filter/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woocommerce-products-filter/reviews/)

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