WooCommerce GDPR – Do not store IP for orders

jarmoluk / Pixabay
Snippet to clear customer IP address when order is sent in WooCommerce
add_action( 'woocommerce_checkout_update_order_meta', 'wc_delete_customer_ip', 1 ); function wc_delete_customer_ip( $order_id ) { update_post_meta( $order_id, '_customer_ip_address', 0 ); }
Stop customer IP from being saved in orders in WooCommerce
add_filter( 'update_post_metadata', 'wc_customer_ip_delete', 10, 3 ); function wc_customer_ip_delete( $null, $id, $key ) { if ( '_customer_ip_address' === $key ) return FALSE; return $null; }