Support » Plugin: WooCommerce » How to purge old orders?

  • Resolved benny Vasquez


    I’m using the following code to pull the total number of products in a given category sold:

    get_post_meta($product_id=’17’, ‘total_sales’, true );

    The problem is that the number is not accurate, as it includes orders that I moved to the trash, and then permanently deleted, in the woocommerce admin interface. Is there a way to completely purge those orders from the database, through the interface? If not, can you guys help me with the syntax to clear out the appropriate data from the appropriate tables? I looked through the tables a bit and think I know what needs to go, but would rather have an assist.

Viewing 1 replies (of 1 total)
  • I was able to figure this one out on my own. I mistakenly was thinking that it was counting a total number of sales. Zeroing out the total_sales column in the postmeta for the appropriate product corrected the problem.

Viewing 1 replies (of 1 total)
  • The topic ‘How to purge old orders?’ is closed to new replies.