Quote from Brad on December 18, 2022, 23:31
Please see https://midwesttread.com/ and click on Search Tires, then under Tire Brand, scroll to the bottom and see the option: YOKOHAMA (337). All Yokohama products are out of stock, so 337 should be zero. How do I ensure all counts of all types are updated correctly?
I've clicked all the regenerate look-up tables, and the similar option is the admin cleared the caches. I've also run the following queries:
UPDATE wp_term_taxonomy AS term
JOIN taxonomy_cnt_vw tax_vw
ON term.term_taxonomy_id = tax_vw.term_taxonomy_id
SET term.count = IFNULL(tax_vw.cnt,0)
WHERE term.taxonomy = 'product_cat'
UPDATE wp_term_taxonomy AS term
JOIN taxonomy_cnt_vw tax_vw
ON term.term_taxonomy_id = tax_vw.term_taxonomy_id
SET term.count = IFNULL(tax_vw.cnt,0)
WHERE term.taxonomy = 'pa_tire-brands'
This is the related view:
CREATE VIEW taxonomy_cnt_vw AS
SELECT posts.term_taxonomy_id AS term_taxonomy_id,
SUM(`meta`.`meta_value`) AS `cnt`
FROM
(wp_postmeta meta
JOIN wp_term_relationships posts)
WHERE meta.meta_key = '_stock'
AND meta.post_id = posts.object_id
GROUP BY posts.term_taxonomy_id
Please see https://midwesttread.com/ and click on Search Tires, then under Tire Brand, scroll to the bottom and see the option: YOKOHAMA (337). All Yokohama products are out of stock, so 337 should be zero. How do I ensure all counts of all types are updated correctly?
I've clicked all the regenerate look-up tables, and the similar option is the admin cleared the caches. I've also run the following queries:
UPDATE wp_term_taxonomy AS term
JOIN taxonomy_cnt_vw tax_vw
ON term.term_taxonomy_id = tax_vw.term_taxonomy_id
SET term.count = IFNULL(tax_vw.cnt,0)
WHERE term.taxonomy = 'product_cat'
UPDATE wp_term_taxonomy AS term
JOIN taxonomy_cnt_vw tax_vw
ON term.term_taxonomy_id = tax_vw.term_taxonomy_id
SET term.count = IFNULL(tax_vw.cnt,0)
WHERE term.taxonomy = 'pa_tire-brands'
This is the related view:
CREATE VIEW taxonomy_cnt_vw AS
SELECT posts.term_taxonomy_id AS term_taxonomy_id,
SUM(`meta`.`meta_value`) AS `cnt`
FROM
(wp_postmeta meta
JOIN wp_term_relationships posts)
WHERE meta.meta_key = '_stock'
AND meta.post_id = posts.object_id
GROUP BY posts.term_taxonomy_id