Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
);
}
@thefuxia

This comment has been minimized.

Copy link

commented Jan 9, 2014

Du kannst schon das erste Speichern verhindern, das geht etwas schneller:

<?php
add_filter( 'update_post_metadata', 'mp1401091554', 10, 3 );

function mp1401091554( $null, $id, $key ) {
    if ( '_customer_ip_address' === $key )
        return FALSE;

    return $null;
}
@dply

This comment has been minimized.

Copy link

commented May 2, 2015

Hallo,

ich hab eine Frage, wo füge ich diesen Code ein?

Vielen Dank für Eure Hilfe

@re4jh

This comment has been minimized.

Copy link

commented Apr 25, 2018

Meines Wissens sind das Hooks
Und die kann man in die functions.php des Themes pflanzen.
/wp-content/themes/deintheme/functions.php

@tommyshellberg

This comment has been minimized.

Copy link

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'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.