• Resolved Hadar Cohen

    (@hadarhacohen)


    I am building a website now, started uploading products, and have problem with product category:
    When going to Products and then to Categories: All are showing “0” products.
    When going to Products – the product line include the selected category for this product correctly.

    How can I resolve it?

    Thanks

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hi @hadarhacohen,

    Thanks for reaching out! I understand you’re seeing “0” products listed next to your categories under Products → Categories, even though your individual products are showing the correct categories assigned. That can definitely be confusing, especially while you’re actively building your store.

    To help investigate this further, could you please clarify a few things for us:

    • Are the products in question published (not in draft or pending status)?
    • Are they Simple or Variable products, and if Variable, have all the variations been assigned pricing and stock?
    • Is your site using High-Performance Order Storage (HPOS)? You can check this under WooCommerce → Settings → Advanced → Features.

    Additionally, please share a screenshot of what you’re seeing using https://snipboard.io or any other tool you prefer. That will help us visually confirm the issue.

    Lastly, please also share your System Status Report. You can get this from WooCommerce → Status → Get system report → Copy for support, and paste it into https://pastebin.com or a similar service. Once we have that, we’ll be in a much better position to guide you forward.

    Looking forward to your reply!

    Thread Starter Hadar Cohen

    (@hadarhacohen)

    Thanks for the fast response!

    All the products are currently marked as draft. I published them all, and it looks OK.
    I wasn’t aware that this might be the issue.

    Is there a way to keep the products in draft or pending, and have the categories counters to show the real number?

      Hi @hadarhacohen,

      Thank you for confirming, and I’m glad publishing the products helped update the category counts!

      To clarify, the category count in Products → Categories only reflects the number of published products. Products that are in draft or pending status are intentionally excluded from that count, since they aren’t yet visible to customers on the frontend. So at this time, there’s no built-in way to include drafts in the category totals.

      That said, it sounds like things are working as expected now, so I’ll go ahead and mark this topic as resolved. If you have any other questions while building your store, please feel free to open a new topic at any time: https://ww.wp.xz.cn/support/plugin/woocommerce/#new-topic-0.

      And if you’ve liked the support you’ve received, we’d appreciate it if you could take a moment to leave a quick review of WooCommerce: https://ww.wp.xz.cn/support/plugin/woocommerce/reviews/#new-post.

      Thanks again and happy store building!

      WP SITES

      (@wordpresssites)

      You can add a custom column like this which includes products based on all statuses.

      add_filter('manage_edit-product_cat_columns', 'custom_product_cat_columns');
      function custom_product_cat_columns($columns) {
      $columns['custom_count'] = __('All', 'woocommerce');
      unset($columns['count']); // Remove default count column
      return $columns;
      }

      add_filter('manage_product_cat_custom_column', 'custom_product_cat_column_content', 10, 3);
      function custom_product_cat_column_content($content, $column, $term_id) {
      if ($column === 'custom_count') {
      $statuses = ['publish', 'draft', 'pending'];
      $count = 0;

      foreach ($statuses as $status) {
      $query = new WP_Query([
      'post_type' => 'product',
      'post_status' => $status,
      'tax_query' => [
      [
      'taxonomy' => 'product_cat',
      'field' => 'term_id',
      'terms' => $term_id,
      ]
      ],
      'fields' => 'ids',
      'posts_per_page' => -1,
      ]);

      $count += $query->found_posts;
      }

      // Link to filtered products by term ID
      $term = get_term($term_id, 'product_cat');
      $url = admin_url('edit.php?post_type=product&product_cat=' . $term->slug);
      $content = '<a href="' . esc_url($url) . '">' . intval($count) . '</a>';
      }
      return $content;
      }
    Viewing 4 replies - 1 through 4 (of 4 total)

    The topic ‘Product category count wrong’ is closed to new replies.