• Just a heads up you should update your wc_delete_orders function to account for different database prefixes.

        public function wc_delete_orders() {
          global $wpdb;
          $ran = true;
          $sql = "DELETE FROM " . $wpdb->prefix . "woocommerce_order_itemmeta";
          $sql = "DELETE FROM " . $wpdb->prefix . "woocommerce_order_items";
          $sql = "DELETE FROM " . $wpdb->prefix . "posts WHERE post_type = 'shop_order'";
          $rows = $wpdb->query( $sql );
    
          if( false !== $rows ) {
            $this->deleted = $rows;
            //add_action( 'admin_notices', array( $this, 'admin_notice_success' ) );
          }
        }
Viewing 1 replies (of 1 total)
  • Nice work! Thanks.

    Even though it says 0 orders deleted it still works.

    I just replaced your updated function with the plugins and bam! They were gone.

Viewing 1 replies (of 1 total)
  • The topic ‘Account for different DB Prefixes’ is closed to new replies.