Hi @evaldash
Please explain what you mean exactly when saying “the order get anonymized”
Woocommerce order details get deleted automatically after a specified time period, in my case after a month. Every field gets changed to (deleted), so no extra unneeded data is kept, following GDPR. This doesn’t seem to work with fields added by this plugin, the details are kept (for example, I’m using this plugin to add fields relating to company data), which isn’t good.
Order anonymization can also be triggered by marking the order, and selecting “Remove personal data”.
Here’s an example of an anonymized order, the extra fields added by this plugin are kept: https://imgur.com/apjLXiX
-
This reply was modified 4 years, 8 months ago by
evaldash.
I see, thank you.
But I’m afraid that plugin is not compatible with the method you use for removing order details.
You will need to integrate the deletion functionality with our plugin custom fields.
Process should be quite simple with the enough developer skills, you only need to delete values from the database.
I managed to find a solution, here it is:
add_action('woocommerce_privacy_remove_order_personal_data', 'delete_additional_data');
function delete_additional_data($order){
$order_id = $order->get_id();
if (get_post_meta( $order_id, '_billing_wooccm9', true ) == "Yes"){
update_post_meta( $order_id, "_billing_wooccm9", '(ištrinta)');
update_post_meta( $order_id, "_billing_wooccm10", '(ištrinta)');
update_post_meta( $order_id, "_billing_wooccm11", '(ištrinta)');
update_post_meta( $order_id, "_billing_wooccm12", '(ištrinta)' );
update_post_meta( $order_id, "_billing_wooccm13", '(ištrinta)');
}
}
It would be great if it were implemented into the plugin one day, since there are 90 000+ installations, and I’m sure that many people don’t know of this issue and are violating GDPR unknowingly.
Update: I noticed that when an order gets deleted, the data doesn’t dissapear either. I modified the code a bit, here’s the updated version:
// Anonymize additional fields added by the plugin "Woocommerce checkout manager" when order gets anonymized
add_action('woocommerce_privacy_remove_order_personal_data', 'anonymize_additional_data');
function anonymize_additional_data($order){
$order_id = $order->get_id();
if (get_post_meta( $order_id, '_billing_wooccm9', true ) == "Yes"){
update_post_meta( $order_id, "_billing_wooccm9", '(ištrinta)');
update_post_meta( $order_id, "_billing_wooccm10", '(ištrinta)');
update_post_meta( $order_id, "_billing_wooccm11", '(ištrinta)');
update_post_meta( $order_id, "_billing_wooccm12", '(ištrinta)' );
update_post_meta( $order_id, "_billing_wooccm13", '(ištrinta)');
}
}
// Delete additional fields added by the plugin "Woocommerce checkout manager" when order gets deleted
add_action('woocommerce_delete_order', 'delete_additional_data');
function delete_additional_data($order){
$order_id = $order->get_id();
delete_post_meta( $order_id, "_billing_wooccm9");
delete_post_meta( $order_id, "_billing_wooccm10");
delete_post_meta( $order_id, "_billing_wooccm11");
delete_post_meta( $order_id, "_billing_wooccm12" );
delete_post_meta( $order_id, "_billing_wooccm13");
}
Thank you for sharing your solution with community.
I’m sure that it will be useful, the dev team is already aware of this and studying its implementation