Forum Replies Created

Viewing 1 replies (of 1 total)
  • Thread Starter hidihinl

    (@hidihinl)

    Hi Oleg, thanks for your answer!

    This is line 52-123. I have very little knowledge of web development and code, so I don’t know if you need that much, my apologies in advance. Line 71 is where it says: } elseif ( in_array( ‘product_cat’, $taxonomies ) && is_shop() ) {

    I hope this can help to detect the problem. If you need any more lines I’m happy to search for them.

    }
    // if a product category and on the shop page
    if (‘hide’ == $afpvu_show_hide) {

                if ( in_array( 'product_cat', $taxonomies ) && is_shop() ) {
    
                    foreach ( $terms as $key => $term ) {
    
                        if ( ( null != $afpvu_applied_categories ) && ( ! in_array( $term->term_id, $afpvu_applied_categories) ) ) {
                            $afpuv_terms[] = $term;
                        }
    
                    }
    
                    $terms = $afpuv_terms;
    
    
                }
    
            } elseif ( in_array( 'product_cat', $taxonomies ) && is_shop() ) {
    
                foreach ( $terms as $key => $term ) {
    
                    if ( is_array($afpvu_applied_categories) && in_array($term->term_id, $afpvu_applied_categories)) {
                        $afpuv_terms[] = $term;
                    }
                }
    
    
    
            $terms = $afpuv_terms;
    
            }
    
            return $terms;
        }
    
        public function afpvu_front_script() {
    
            wp_enqueue_style('afpvu-front', plugins_url('/assets/css/afpvu_front.css', __FILE__), false, '1.0');
        }
    
        public function afpvu_product_hidden( $product_id, $applied_products, $applied_categories, $show_hide ) {
    
            if ('hide' === $show_hide) {
    
                if (in_array($product_id, $applied_products)) {
                    return true;
                }
    
                foreach ($applied_categories as $cat) {
                    if (!empty($cat) && has_term($cat, 'product_cat', $product_id)) {
                        return true;
                    }
                }
    
                return false;
            } else {
    
                if (in_array($product_id, $applied_products)) {
                    return false;
                }
    
                foreach ($applied_categories as $cat) {
                    if (!empty($cat) && has_term($cat, 'product_cat', $product_id)) {
                        return false;
                    }
                }
    
                return true;
            }
        }
Viewing 1 replies (of 1 total)