
Are you using the WP Frontend Delete Account plugin to allow users to delete their own accounts? If you’re using the plugin in your e-Commerce site, note that the personal data from the orders, downloads, and customer’s tokens are not automatically deleted when the customer deletes themselves. This might be a requirement for GDPR.
While the feature is on the roadmap for the future release of the plugin, in the meantime, you can accomplish this with a little custom code in your functions.php file. If you are not already familiar with adding custom code snippets to your site, check out this tutorial.
add_action( 'wp_frontend_delete_account_process_complete', function( $user ) {
if ( ! defined( 'WC_VERSION' ) ) {
return;
}
WC_Privacy_Erasers::customer_data_eraser( $user->user_email, -1 );
WC_Privacy_Erasers::order_data_eraser( $user->user_email, -1 );
WC_Privacy_Erasers::download_data_eraser( $user->user_email, -1 );
WC_Privacy_Erasers::customer_tokens_eraser( $user->user_email, -1 );
});
I hope this helps! Have you ever wondered why your WooCommerce orders are stuck at processing?