Skip to content

Instantly share code, notes, and snippets.

@glueckpress
Created January 9, 2014 15:29
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save glueckpress/8335883 to your computer and use it in GitHub Desktop.
Save glueckpress/8335883 to your computer and use it in GitHub Desktop.
Snippet to clear customer IP address when order is sent. #woocommerce #wordpress
<?php
/**
* Snippet for deleting the customer IP address from WooCommerce orders.
* Important for Trusted Shops® certificates in Germany.
*/
add_action( 'woocommerce_checkout_update_order_meta', 'mp1401091554', 1 );
function mp1401091554( $order_id ) {
update_post_meta(
$order_id,
'_customer_ip_address',
0
);
}
@tommyshellberg
Copy link

tommyshellberg commented Apr 15, 2019

It is probably easier to just run an SQL query if it's a one-time thing:

DELETE FROM wp_postmeta WHERE meta_key = '_customer_ip_address'

@MladenUnwastify
Copy link

Hi @tommyshellberg, I've tried to use your SQL query but unfortunately still didn't know how to remove already stored ip adresses. I've used the php code stated in the beginning of this conversation to remove the ip adresses of future customers and it worked. But I still would need to figure out how to remove the ip adresses of already existing customers. I'd be very grateful if someone could help me out!

@alexandervlpl
Copy link

This still works, thanks! 👍 I have a feeling this mp1401091554 key can change in any future version of WooCommerce/WordPress though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment