Skip to content

Instantly share code, notes, and snippets.

@tuongpgjz
Created October 12, 2022 02:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tuongpgjz/2c02093bc073ab81d0b021d14f6623ba to your computer and use it in GitHub Desktop.
Save tuongpgjz/2c02093bc073ab81d0b021d14f6623ba to your computer and use it in GitHub Desktop.
Correct product count on categories WooCommerce - SQL
-- Run this SQL commands from PhpMyAdmin or similar ways
-- change the wp_ to your tables prefix to make it works
-- Script from SalesGen.io
UPDATE wp_term_taxonomy tt SET count = (SELECT COUNT(object_id) FROM wp_term_relationships WHERE term_taxonomy_id = tt.term_taxonomy_id) WHERE taxonomy = 'product_cat';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment