Skip to content

Instantly share code, notes, and snippets.

@mikejolley
Created March 25, 2012 11:38
Show Gist options
  • Save mikejolley/2193064 to your computer and use it in GitHub Desktop.
Save mikejolley/2193064 to your computer and use it in GitHub Desktop.
WooCommerce - Store customer IP in order meta
// Code goes in functions.php
add_action( 'woocommerce_checkout_update_order_meta', 'wc_store_user_ip' );
function wc_store_user_ip( $order_id ) {
update_post_meta( $order_id, 'Customer IP', $_SERVER['REMOTE_ADDR'] );
}
@Ramoonus
Copy link

why not include this in the core, to avoid fake customers and be able to block them?

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