Recount products in categories?
-
Hello,
currently I’m working on an development environment and I’ve noticed that the product count for the categories e.g. in the backend wasn’t correct. I tried several WooCommerce Tools like “Regenerate Product Lookup Tables” and “Recount Terms”, but nothing changed.
Even after deleting all products via “WP Bulk Delete” plugin (after making a backup) and running all WooCommerce tools for several times, there are 20 categories with a product count unlike zero.
Is there a reliable way to recount all product? It should be an automatic option, because there are 310 categories in this shop, with approx. 3.000 main products (simple/variable), when not deleted.
-
Hi @apfelbiss,
The number you see under
Count
in WP dashboard > Products > Categories reflects the number of products associated with that specific product category:
Link to image: https://i.imgur.com/7Zn7zNE.pngCan you take screenshots and show us what you’re seeing and the numbers that do not match? I recommend https://snipboard.io for easily sharing screenshots – please follow the instructions on that page, then paste the URL in this thread.
To check the count in the database, you may want to take a look at the
wp_term_taxonomy
table. Look for the product category ID value first and check if the count number matches the number in the backend.* https://i.imgur.com/gjBZW8s.png
* https://i.imgur.com/0mdRwoz.pngWe look forward to hearing from you.
Hello,
all products were deleted successfully:
https://snipboard.io/3ZgJ2M.jpgBut there are still 20 categorires that say that there are products in it:
https://snipboard.io/KMqD2h.jpgClicking a number, I only see the screen from the first linked image.
The numbers in the “wp_term_taxonomy” table are the same:
https://snipboard.io/neIQbE.jpgHello,
Even after deleting all products via “WP Bulk Delete” plugin (after making a backup) and running all WooCommerce tools for several times, there are 20 categories with a product count unlike zero.
I understand after deleting the products, there are still categories having products.
To take a better look, could you please share a copy of your site’s
System Status
? You can find it viaWooCommerce > Status
. Select “Get system report” and then “Copy for support”.?Also, share a copy of any fatal
error log
found under WooCommerce > System Status > Logs (if available).Thanks.
Hello Igor,
here is the System Status:
### WordPress Environment ### WordPress address (URL): ------ Site address (URL): ------ WC Version: 6.2.0 REST API Version: ? 6.2.0 WC Blocks Version: ? 6.7.3 Action Scheduler Version: ? 3.4.0 WC Admin Version: ? 3.1.0 Log Directory Writable: ? WP Version: 5.9 WP Multisite: – WP Memory Limit: 768 MB WP Debug Mode: – WP Cron: ? Language: de_DE_formal External object cache: – ### Server Environment ### Server Info: Apache PHP Version: 7.4.27 PHP Post Max Size: 20 MB PHP Time Limit: -1 PHP Max Input Vars: 10000 cURL Version: 7.81.0 OpenSSL/1.1.1m SUHOSIN Installed: – MySQL Version: 5.7.37 Max Upload Size: 20 MB Default Timezone is UTC: ? fsockopen/cURL: ? SoapClient: ? Ihr Server verfügt nicht über eine lauff?hige Version der SoapClient Klasse - einige Zahlungsschnittstellen welche SOAP nutzen funktionieren unter Umst?nden nicht korrekt. DOMDocument: ? GZip: ? Multibyte String: ? Remote Post: ? Remote Get: ? ### Database ### WC Database Version: 6.2.0 WC Database Prefix: wp24981_ Datenbank-Gesamtgr??e: 361.67MB Datenbank-Datengr??e: 299.00MB Datenbank-Indexgr??e: 62.67MB wp24981_woocommerce_sessions: Daten: 0.02MB + Index: 0.02MB + Engine InnoDB wp24981_woocommerce_api_keys: Daten: 0.02MB + Index: 0.03MB + Engine InnoDB wp24981_woocommerce_attribute_taxonomies: Daten: 0.02MB + Index: 0.02MB + Engine InnoDB wp24981_woocommerce_downloadable_product_permissions: Daten: 0.02MB + Index: 0.06MB + Engine InnoDB wp24981_woocommerce_order_items: Daten: 0.02MB + Index: 0.02MB + Engine InnoDB wp24981_woocommerce_order_itemmeta: Daten: 0.02MB + Index: 0.03MB + Engine InnoDB wp24981_woocommerce_tax_rates: Daten: 0.02MB + Index: 0.06MB + Engine InnoDB wp24981_woocommerce_tax_rate_locations: Daten: 0.02MB + Index: 0.03MB + Engine InnoDB wp24981_woocommerce_shipping_zones: Daten: 0.02MB + Index: 0.00MB + Engine InnoDB wp24981_woocommerce_shipping_zone_locations: Daten: 0.02MB + Index: 0.03MB + Engine InnoDB wp24981_woocommerce_shipping_zone_methods: Daten: 0.02MB + Index: 0.00MB + Engine InnoDB wp24981_woocommerce_payment_tokens: Daten: 0.02MB + Index: 0.02MB + Engine InnoDB wp24981_woocommerce_payment_tokenmeta: Daten: 0.02MB + Index: 0.03MB + Engine InnoDB wp24981_woocommerce_log: Daten: 0.02MB + Index: 0.02MB + Engine InnoDB wp24981_actionscheduler_actions: Daten: 1.52MB + Index: 0.69MB + Engine InnoDB wp24981_actionscheduler_claims: Daten: 0.02MB + Index: 0.02MB + Engine InnoDB wp24981_actionscheduler_groups: Daten: 0.02MB + Index: 0.02MB + Engine InnoDB wp24981_actionscheduler_logs: Daten: 0.48MB + Index: 0.38MB + Engine InnoDB wp24981_borlabs_cookie_consent_log: Daten: 0.02MB + Index: 0.02MB + Engine InnoDB wp24981_borlabs_cookie_content_blocker: Daten: 0.02MB + Index: 0.02MB + Engine InnoDB wp24981_borlabs_cookie_cookies: Daten: 0.02MB + Index: 0.03MB + Engine InnoDB wp24981_borlabs_cookie_groups: Daten: 0.02MB + Index: 0.02MB + Engine InnoDB wp24981_borlabs_cookie_script_blocker: Daten: 0.02MB + Index: 0.02MB + Engine InnoDB wp24981_commentmeta: Daten: 0.02MB + Index: 0.03MB + Engine InnoDB wp24981_comments: Daten: 0.02MB + Index: 0.09MB + Engine InnoDB wp24981_e_submissions: Daten: 0.02MB + Index: 0.27MB + Engine InnoDB wp24981_e_submissions_actions_log: Daten: 0.02MB + Index: 0.11MB + Engine InnoDB wp24981_e_submissions_values: Daten: 0.02MB + Index: 0.03MB + Engine InnoDB wp24981_gf_draft_submissions: Daten: 0.02MB + Index: 0.02MB + Engine InnoDB wp24981_gf_entry: Daten: 0.02MB + Index: 0.03MB + Engine InnoDB wp24981_gf_entry_meta: Daten: 0.02MB + Index: 0.05MB + Engine InnoDB wp24981_gf_entry_notes: Daten: 0.02MB + Index: 0.03MB + Engine InnoDB wp24981_gf_form: Daten: 0.02MB + Index: 0.00MB + Engine InnoDB wp24981_gf_form_meta: Daten: 0.13MB + Index: 0.00MB + Engine InnoDB wp24981_gf_form_revisions: Daten: 0.02MB + Index: 0.03MB + Engine InnoDB wp24981_gf_form_view: Daten: 0.02MB + Index: 0.03MB + Engine InnoDB wp24981_gf_rest_api_keys: Daten: 0.02MB + Index: 0.03MB + Engine InnoDB wp24981_links: Daten: 0.02MB + Index: 0.02MB + Engine InnoDB wp24981_ms_snippets: Daten: 0.02MB + Index: 0.00MB + Engine InnoDB wp24981_ninja_table_items: Daten: 0.02MB + Index: 0.00MB + Engine InnoDB wp24981_options: Daten: 3.52MB + Index: 0.08MB + Engine InnoDB wp24981_postmeta: Daten: 164.55MB + Index: 11.03MB + Engine InnoDB wp24981_posts: Daten: 89.55MB + Index: 1.05MB + Engine InnoDB wp24981_redirection_404: Daten: 0.02MB + Index: 0.05MB + Engine InnoDB wp24981_redirection_groups: Daten: 0.02MB + Index: 0.03MB + Engine InnoDB wp24981_redirection_items: Daten: 0.02MB + Index: 0.09MB + Engine InnoDB wp24981_redirection_logs: Daten: 0.02MB + Index: 0.05MB + Engine InnoDB wp24981_snippets: Daten: 0.08MB + Index: 0.00MB + Engine InnoDB wp24981_termmeta: Daten: 0.30MB + Index: 0.34MB + Engine InnoDB wp24981_terms: Daten: 0.09MB + Index: 0.09MB + Engine InnoDB wp24981_term_relationships: Daten: 0.48MB + Index: 0.27MB + Engine InnoDB wp24981_term_taxonomy: Daten: 0.09MB + Index: 0.11MB + Engine InnoDB wp24981_usermeta: Daten: 18.55MB + Index: 20.06MB + Engine InnoDB wp24981_users: Daten: 1.52MB + Index: 0.73MB + Engine InnoDB wp24981_wc_admin_notes: Daten: 0.02MB + Index: 0.00MB + Engine InnoDB wp24981_wc_admin_note_actions: Daten: 0.02MB + Index: 0.02MB + Engine InnoDB wp24981_wc_category_lookup: Daten: 0.06MB + Index: 0.00MB + Engine InnoDB wp24981_wc_customer_lookup: Daten: 0.02MB + Index: 0.03MB + Engine InnoDB wp24981_wc_download_log: Daten: 0.02MB + Index: 0.03MB + Engine InnoDB wp24981_wc_order_coupon_lookup: Daten: 0.02MB + Index: 0.03MB + Engine InnoDB wp24981_wc_order_product_lookup: Daten: 0.02MB + Index: 0.06MB + Engine InnoDB wp24981_wc_order_stats: Daten: 0.02MB + Index: 0.05MB + Engine InnoDB wp24981_wc_order_tax_lookup: Daten: 0.02MB + Index: 0.03MB + Engine InnoDB wp24981_wc_product_attributes_lookup: Daten: 0.02MB + Index: 0.00MB + Engine InnoDB wp24981_wc_product_meta_lookup: Daten: 1.52MB + Index: 1.28MB + Engine InnoDB wp24981_wc_rate_limits: Daten: 0.02MB + Index: 0.02MB + Engine InnoDB wp24981_wc_reserved_stock: Daten: 0.02MB + Index: 0.00MB + Engine InnoDB wp24981_wc_tax_rate_classes: Daten: 0.02MB + Index: 0.02MB + Engine InnoDB wp24981_wc_webhooks: Daten: 0.02MB + Index: 0.02MB + Engine InnoDB wp24981_woodmart_wishlists: Daten: 0.02MB + Index: 0.00MB + Engine InnoDB wp24981_woodmart_wishlist_products: Daten: 0.02MB + Index: 0.02MB + Engine InnoDB wp24981_woof_query_cache: Daten: 0.02MB + Index: 0.02MB + Engine InnoDB wp24981_wpf_filters: Daten: 0.02MB + Index: 0.00MB + Engine InnoDB wp24981_wpf_meta_data: Daten: 11.52MB + Index: 21.58MB + Engine InnoDB wp24981_wpf_meta_keys: Daten: 0.02MB + Index: 0.02MB + Engine InnoDB wp24981_wpf_meta_values: Daten: 1.52MB + Index: 1.63MB + Engine InnoDB wp24981_wpf_meta_values_bk: Daten: 0.02MB + Index: 0.02MB + Engine InnoDB wp24981_wpf_modules: Daten: 0.02MB + Index: 0.02MB + Engine InnoDB wp24981_wpf_modules_type: Daten: 0.02MB + Index: 0.00MB + Engine InnoDB wp24981_wpf_usage_stat: Daten: 0.02MB + Index: 0.02MB + Engine InnoDB wp24981_wt_iew_action_history: Daten: 0.27MB + Index: 0.00MB + Engine InnoDB wp24981_wt_iew_cron: Daten: 0.02MB + Index: 0.00MB + Engine InnoDB wp24981_wt_iew_ftp: Daten: 0.02MB + Index: 0.00MB + Engine InnoDB wp24981_wt_iew_mapping_template: Daten: 0.02MB + Index: 0.00MB + Engine InnoDB wp24981_yoast_indexable: Daten: 1.52MB + Index: 0.97MB + Engine InnoDB wp24981_yoast_indexable_hierarchy: Daten: 0.14MB + Index: 0.22MB + Engine InnoDB wp24981_yoast_migrations: Daten: 0.02MB + Index: 0.02MB + Engine InnoDB wp24981_yoast_primary_term: Daten: 0.02MB + Index: 0.03MB + Engine InnoDB wp24981_yoast_seo_links: Daten: 0.23MB + Index: 0.17MB + Engine InnoDB ### Post Type Counts ### acf-field: 14 acf-field-group: 4 attachment: 722 cms_block: 14 cpt_variation_fields: 1 elementor_library: 22 nav_menu_item: 359 ninja-table: 1 oembed_cache: 7 page: 56 post: 1 revision: 4792 wishlist: 1 woodmart_sidebar: 3 wp_global_styles: 1 ### Security ### Secure connection (HTTPS): ? Hide errors from visitors: ? ### Active Plugins (32) ### Gravity Forms: von Gravity Forms – 2.5.16 Advanced Custom Fields: von Delicious Brains – 5.11.4 Borlabs Cookie - Cookie Opt-in: von Benjamin A. Bornschein Borlabs – 2.2.43 Code Snippets: von Code Snippets Pro – 2.14.3 Yoast Duplicate Post: von Enrico Battocchi & Team Yoast – 4.4 Elementor Pro: von Elementor.com – 3.6.0 Elementor: von Elementor.com – 3.5.5 Enable Media Replace: von ShortPixel – 3.6.3 WooCommerce Custom Fields for Variations by Iconic: von Iconic – 1.3.0 Import and export users and customers: von codection – 1.19.1.9 Language Fallback: von Bernhard Kau – 1.0.5 Ninja Tables: von WPManageNinja LLC – 4.1.11 Post Snippets: von Postsnippets – 3.1.6 Product Filter for WooCommerce: von XforWooCommerce – 8.2.1 Fixed Widget: von Thomas Maier Max Bond – 6.0.4 Redirection: von John Godley – 5.2.3 Safe SVG: von Daryll Doyle – 1.9.9 Timed Content: von K. Tough Arno Welzel Enrico Bacis – 2.66 UpdraftPlus - Backup/Restore: von UpdraftPlus.Com DavidAnderson – 1.22.3 User Role Editor: von Vladimir Garagulya – 4.61.1 User Switching: von John Blackbourn und Mitwirkende – 1.5.8 WooCommerce Dynamic Pricing & Discounts: von RightPress – 2.4.3 PayPal Plus für WooCommerce: von Angell EYE – 1.2.16 WooCommerce Gravity Forms Product Add-Ons: von Element Stark – 3.3.23 WooCommerce WishLists: von Element Stark – 2.2.5 WooCommerce: von Automattic – 6.2.0 Woodmart Core: von – 1.0.31 Yoast SEO: von Team Yoast – 18.1 WP Bulk Delete: von Xylus Themes – 1.2.2 Product Import Export for WooCommerce Add-on: von WebToffee – 1.0.9 Product Reviews Import Export for WooCommerce Add-on: von WebToffee – 1.0.6 Import Export for WooCommerce Wrapper: von WebToffee – 1.1.2 ### Inactive Plugins (0) ### ### Settings ### API Enabled: – Force SSL: – Currency: EUR (€) Currency Position: left_space Thousand Separator: . Decimal Separator: , Number of Decimals: 2 Taxonomies: Product Types: external (external) grouped (grouped) simple (simple) variable (variable) Taxonomies: Product Visibility: exclude_from_catalog (exclude_from_catalog) exclude_from_search (exclude_from_search) exclude-from-catalog (exclude-from-catalog) exclude-from-search (exclude-from-search) featured (featured) hidden (hidden) outofstock (outofstock) rated-1 (rated-1) rated-2 (rated-2) rated-3 (rated-3) rated-4 (rated-4) rated-5 (rated-5) search (search) visible (visible) Connected to WooCommerce.com: – ### WC Pages ### Shop-Basis: #18 - /shop/ Warenkorb: #19 - /warenkorb/ Kasse: #20 - /kasse/ Mein Konto: #21 - /mein-konto/ Allgemeine Gesch?ftsbedingungen: ? Seite nicht festgelegt ### Theme ### Name: Woodmart Child Version: 1.0.0 Author URL: https://xtemos.com Child Theme: ? Parent Theme Name: Woodmart Parent Theme Version: 6.2.4 Parent Theme Author URL: https://themeforest.net/user/xtemos WooCommerce Support: ? ### Templates ### Overrides: woodmart-child/woocommerce/archive-product.php woodmart/woocommerce/cart/cart-item-data.php woodmart/woocommerce/cart/cart.php woodmart/woocommerce/cart/cross-sells.php woodmart/woocommerce/cart/mini-cart.php woodmart/woocommerce/checkout/form-checkout.php woodmart/woocommerce/checkout/thankyou.php woodmart/woocommerce/content-product-cat.php woodmart/woocommerce/content-product.php woodmart-child/woocommerce/content-single-product.php woodmart/woocommerce/content-widget-product.php woodmart/woocommerce/global/breadcrumb.php woodmart/woocommerce/global/form-login.php woodmart/woocommerce/global/quantity-input.php woodmart/woocommerce/loop/add-to-cart.php woodmart/woocommerce/loop/loop-end.php woodmart/woocommerce/loop/loop-start.php woodmart/woocommerce/loop/no-products-found.php woodmart/woocommerce/loop/orderby.php woodmart/woocommerce/loop/pagination.php woodmart/woocommerce/loop/sale-flash.php woodmart/woocommerce/myaccount/form-login.php woodmart/woocommerce/product-searchform.php woodmart/woocommerce/single-product/add-to-cart/grouped.php woodmart/woocommerce/single-product/add-to-cart/variable.php Version 3.5.5 ist veraltet. Die Hauptversion ist 6.1.0 woodmart-child/woocommerce/single-product/add-to-cart/variation.php woodmart-child/woocommerce/single-product/meta.php woodmart-child/woocommerce/single-product/price.php woodmart/woocommerce/single-product/product-image.php woodmart/woocommerce/single-product/product-thumbnails.php woodmart/woocommerce/single-product/rating.php woodmart/woocommerce/single-product/related.php woodmart/woocommerce/single-product/sale-flash.php woodmart-child/woocommerce/single-product/tabs/tabs.php woodmart-child/woocommerce/single-product/title.php woodmart/woocommerce/single-product/up-sells.php woodmart/woocommerce/single-product.php Outdated Templates: ? Erfahren Sie wie Sie aktualisieren k?nnen ### Action Scheduler ### Abgeschlossen: 2.014 Oldest: 2022-02-18 14:48:29 +0100 Newest: 2022-02-22 14:09:20 +0100 ### Status report information ### Generated at: 2022-02-22 14:09:42 +01:00
The Fatal Error log only shows old errors generated by temporarily incorrect code within a customized template or code snippets:
2022-02-18T09:55:03+00:00 CRITICAL Uncaught Error: Object of class WP_Term could not be converted to string in /wp-content/themes/woodmart-child/woocommerce/taxonomy-pa_hersteller.php:105 2022-02-16T14:03:07+00:00 CRITICAL Uncaught Error: Call to undefined function the_field() in /wp-content/plugins/code-snippets/php/snippet-ops.php(469) : eval()'d code:73 2022-02-16T14:01:07+00:00 CRITICAL Uncaught Error: Call to undefined function the_field() in /wp-content/themes/woodmart-child/woocommerce/content-product-base.php:74 2022-02-16T14:00:41+00:00 CRITICAL Uncaught Error: Call to undefined function category_has_children() in /wp-content/themes/woodmart-child/woocommerce/archive-product.php:123 2022-02-16T14:00:35+00:00 CRITICAL Uncaught Error: Call to undefined function the_field() in /wp-content/themes/woodmart-child/woocommerce/content-single-product.php:175 2022-02-16T11:31:52+00:00 CRITICAL Uncaught Error: Call to a member function is_type() on null in /wp-content/plugins/code-snippets/php/snippet-ops.php(469) : eval()'d code:3 2022-01-28T07:25:19+00:00 CRITICAL Uncaught Error: Call to undefined function the_field() in /wp-content/themes/woodmart-child/woocommerce/content-product-base.php:74 2022-01-28T07:23:25+00:00 CRITICAL Uncaught Error: Call to undefined function category_has_children() in /wp-content/themes/woodmart-child/woocommerce/archive-product.php:119 2022-01-27T15:21:38+00:00 CRITICAL syntax error, unexpected '}', expecting ';' or ',' in /wp-content/themes/woodmart-child/woocommerce/archive-product.php in Zeile 98 2022-01-27T13:30:11+00:00 CRITICAL syntax error, unexpected '=' in /wp-content/themes/woodmart-child/woocommerce/archive-product.php in Zeile 144 2022-01-27T13:26:36+00:00 CRITICAL Uncaught Error: Call to a member function get_price_html() on int in /wp-content/themes/woodmart-child/woocommerce/archive-product.php:153 2022-01-27T13:25:50+00:00 CRITICAL syntax error, unexpected ')', expecting ';' or ',' in /wp-content/themes/woodmart-child/woocommerce/archive-product.php in Zeile 153 2022-01-27T13:21:04+00:00 CRITICAL Uncaught Error: Call to undefined function price_html() in /wp-content/themes/woodmart-child/woocommerce/archive-product.php:153 2022-01-27T13:02:43+00:00 CRITICAL Uncaught Error: Call to undefined function get_price_html() in /wp-content/themes/woodmart-child/woocommerce/archive-product.php:153 2022-01-27T13:01:54+00:00 CRITICAL Uncaught Error: Call to a member function get_price_html() on null in /wp-content/themes/woodmart-child/woocommerce/archive-product.php:153
Hi @apfelbiss
Can you navigate to WooCommerce > Status > Tools, and clear transients to see if that helps?
Link to image: https://snipboard.io/fr2B1N.jpg
Hello,
I did run all WooCommerce tools multiple times and also checked, that there is no pending job at the action scheduler, but nothing changed.
For your informnation:
The products were imported via Product Import Export Plugin for WooCommerce and deleted via “WP Bulk Delete” plugin (as already mentioned).First run of the tool for deleting orphaned variations, 579 were deleted, second time 52 were deleted, third time 1 was deleted, fourth time 0 were deleted.
Hello,
Have you performed a conflict test? You can perform it following these steps:
- Temporarily switch your theme to Storefront
- Disable all plugins except for WooCommerce
- Repeat the action that is causing the problem
After that, go to WooCommerce > Status > Tools > Term counts > Click – Recount Terms. (I’ve read you already did, but let’s try again only with WooCommerce core and Storefront theme active).
Then you can reactivate your plugins one by one.
You can find a more detailed explanation on how to do a conflict test here.Let us know if this makes a difference.
Hello,
unfortunately, this made no difference.
I set template to Storefront and deactivated all plugins except WooCommerce.
Then I did run all WooCommerce tools one by one, even a second time.
I also checked that there is no pending job in the WooCommerce action scheduler.Hello,
Thanks for your response.I understand the products were deleted.
To clarify, can you tell me if there are any products on Trash?
Link to image: https://snipboard.io/VlCYfe.jpgWere the products deleted from the Trash as well?
Let us know thanks.
Hello,
there don’t seem to be any trashed products:
https://snipboard.io/3ZgJ2M.jpgI even checked it in the database, there are no entries in “wp_posts” with a post_type that contains “product”.
Hello,
I was checking on my testing site, I could delete all items, using the same plugin:
Link to image: https://snipboard.io/Kbhzw7.jpgNo items in categories after deletion.
Link to image: https://snipboard.io/TZc3L9.jpgMy recommendation is to contact the plugin support here.
Thank you.
We haven’t heard back from you in a while, so I’m going to mark this as resolved – we’ll be here if and/or when you are ready to continue.
Thank you.
- The topic ‘Recount products in categories?’ is closed to new replies.