Regenerating product tables does not account for deleted orders
#27,359 opened on Aug 17, 2020
Repository metrics
- Stars
- (10,294 stars)
- PR merge metrics
- (Avg merge 9d 12h) (423 merged PRs in 30d)
Description
Prerequisites (mark completed items with an [x]):
- I have carried out troubleshooting steps and I believe I have found a bug.
- I have searched for similar bugs in both open and closed issues and cannot find a duplicate.
Describe the bug
The issue started when looking for differences between the best seller shortcode ( [products limit="3" columns="3" best_selling="true" ] ) and the Best Selling Products block. After permently deleting orders the total_sales within wc_product_meta_lookup and wp_postmeta.
Expected behavior
When orders are deleted, both total_sales values be updated to that shortcode and block product tools show the correct information.
Steps to reproduce the bug (We need to be able to reproduce the bug in order to fix it.) Steps to reproduce the bug:
- Review
total_salesfor a specific post id withinwc_product_meta_lookupandwp_postmeta - Permanently delete all orders specific to that product
- Regenerate product lookup tables ( wc > status > tools )
- See total sales meta values unchanged
Isolating the problem (mark completed items with an [x]):
- I have deactivated other plugins and confirmed this bug occurs when only WooCommerce plugin is active.
- This bug happens with a default WordPress theme active, or Storefront.
- I can reproduce this bug consistently using the steps above.