WordPress.org

Ready to get started?Download WordPress

Forums

MesoColumn
[resolved] Invalid argument? (4 posts)

  1. johnc1979
    Member
    Posted 5 months ago #

    I'm using the wonderful theme mesecolumn with a woocommerce installation.

    I'm getting one line of error only on the shop page. It is:
    Warning: Invalid argument supplied for foreach() in /home/u665221498/public_html/wp-content/themes/mesocolumn/lib/woocommerce/woocommerce-theme-functions.php on line 136

    There is no message anywhere else, only on the shop section. It displays just above the products on the shop page.

    Is there a way to fix this?

    Thanks

  2. Richie KS
    Member
    Theme Author

    Posted 5 months ago #

    make sure you item had 1 category assign at least. or edit line 135
    mesocolumn/lib/woocommerce/woocommerce-theme-functions.php to

    $terms = get_the_terms( $post->ID, 'product_cat' );
    if( count($terms) > 0 ) {
     foreach ($terms as $term) {
        $product_cat_id = $term->term_id;
        break;
    }
    }
  3. johnc1979
    Member
    Posted 5 months ago #

    Thanks, that did the trick

  4. spiney
    Member
    Posted 1 month ago #

    I have applied the code above and now the error changed to this

    Warning: Invalid argument supplied for foreach() in /home/house/public_html/wxx.org/wp-content/themes/mesocolumn/lib/woocommerce/woocommerce-theme-functions.php on line 137

Reply

You must log in to post.

About this Theme

About this Topic