• Resolved slimmyweight

    (@slimmyweight)


    Hi Can I stop woocommerce from storing customers IP in orders?

    If this can only be done through code can you tell me where as I’m not a web developer although I can understand some basics of coding so make it very clear for me please if this is the only option.

Viewing 9 replies - 1 through 9 (of 9 total)
  • Hello @slimmyweight ,

    Thanks for reaching out!

    This article here suggests using this two-piece of codes in your theme’s functions.php or using a snippet plugin –

    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
    );
    }
    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;
    }

    If you are not sure about using them properly, I will recommend getting in touch with a Woo expert.

    Thank you ??

    Rynald0s

    (@rynald0s)

    Automattic Happiness Engineer

    Howdy.

    We haven’t heard back from you in a while, so I’m going to go ahead and mark this thread as resolved. If you have any other questions please start a new thread.

    Cheers!

    Thread Starter slimmyweight

    (@slimmyweight)

    Hi sorry for hte late reply I forgot to check back, I’ve seen similar code before how do I find my child themes function.php?

    Hello @slimmyweight ,

    That’s a good question.

    If you already have a child theme active then you can find its functions.php file in two different ways –

    1. Navigate to wp-admin > Appearance > Theme editor > functions.php
    2. Using FTP and accessing the theme file from wp-content > themes > child-theme > functions.php. If you do not have your FTP details, ask your hosting provider. They will help you with the process.

    Alternatively, you can use a snippet plugin to add custom code on the site.

    Thank you ??

    Thread Starter slimmyweight

    (@slimmyweight)

    Thanks so I just found my child themes function.php

    I placed the code at the bottom and it caused my site to crash so I removed it, this is my child themes function.php code I cant figure out where to put it:

    <?php
    /**
    * Astra Child Theme functions and definitions
    *
    * @link https://developer.www.ads-software.com/themes/basics/theme-functions/
    *
    * @package Astra Child
    * @since 1.0.0
    */

    /**
    * Define Constants
    */
    define( ‘CHILD_THEME_ASTRA_CHILD_VERSION’, ‘1.0.0’ );

    /**
    * Enqueue styles
    */
    function child_enqueue_styles() {

    wp_enqueue_style( ‘astra-child-theme-css’, get_stylesheet_directory_uri() . ‘/style.css’, array(‘astra-theme-css’), CHILD_THEME_ASTRA_CHILD_VERSION, ‘all’ );

    }

    add_action( ‘wp_enqueue_scripts’, ‘child_enqueue_styles’, 15 );

    • This reply was modified 3 years, 11 months ago by slimmyweight.

    Hello @slimmyweight ,

    The code should work fine in your functions.php file.

    I will recommend that you add them to using a snippet plugin to avoid issues.

    Also, if you need a paid solution, you can consider taking help from one of our partner’s website.

    Thank you ??

    Thread Starter slimmyweight

    (@slimmyweight)

    Thanks for suggesting the snippet plugin my only concern if I use it what if I put code in that causes the site to crash I wont be able to remove the changes with the site being down will I?

    Rynald0s

    (@rynald0s)

    Automattic Happiness Engineer

    Hi @slimmyweight!

    That is the beauty of the snippets plugin as it acts as a safety net. If there is an error in the code, it won’t bring your site down, and it would give you notice at the same time. If you added the code directly to your site, via the functions.php file, however, then yes, it would come crashing down.

    Cheers!

    Hi there,

    We’ve not heard back from you in a while, so I’m marking this thread as resolved.

    Hopefully, you were able to find a solution to your problem! If you have further questions, please feel free to open a new topic.

    Thank you ??

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Removing storage of customers IP in products’ is closed to new replies.