GDPR WooCommerce custom privacy policy checkbox
  • LET'S TALK!

    Fill in the form below to make an enquiry or find my contact details on my contact page.

  • This field is for validation purposes and should be left unchanged.

Freelance WordPress Developer

GDPR WooCommerce custom privacy policy checkbox

What is GDPR Compliance?

A quick summary of site owners’ obligations relating to the collection of user data from EU citizens:

  • Tell the user what your site is and why you are collecting their personal data
  • Tell the user how long you will have their data and who will receive this information
  • Get consent from users before collecting any user data
  • Let users access their own data and take it with them
  • Enable users to delete their own personal data
  • Let users known if any data breaches affect their data

 

GDPR Compliance with WordPress

In case you’re a WordPress plugin author that has a plugin that handles user data, you need to be aware of the new EU GDPR compliance that will come into effect from May 2018.  WordPress is developing a GDPR plugin standard this means that there will be a unified descriptive methodology of the type of data being stored, where it is stored and how long it is there for this plugin standard will also offer key information on how to safely handle the deletion of any user data.

This new plugin standard from WordPress aims to give developers a simple solution to GDPR compliance when it comes to validating your plugin.  It also ensures that Website Administrators will have the overview and tools they need to handle any tasks associated with GDPR compliance. This solution from WordPress is free and offers a simple guide to creating a file.  This file will describe all of the different user data that the plugin is likely to handle.  This file will be available for anyone to read.

What You Need to Be Aware of As a WooCommerce Shop Owner

Firstly, it’s super important that you do your research on GDPR compliance as each WooCommerce site will use a different set of plugins.  With this new EU law, there isn’t a one-size-fits-all approach.  You will need to be aware of why you need to do for your specific site.
If you sell products to customers within the EU or have EU shoppers visiting your WooCommerce site, you’ll need to ensure your site complies with GDPR.  It’s your responsibility to communicate how you are using your customers’ information.  Also, this means you may need to update the privacy policy for your site to make clear how your WooCommerce site will comply with GDPR.

What Resources Are Available to Help with GDPR Compliance?

We need to make clear that GDPR will impact how every site in the EU operates.  There’s a lot of help and resources out there to assist you.  Make sure to check out the Complete WordPress GDPR Guide from Code in WordPress.  This provides a detailed overview of how they will help plugin developers ensure they are GDPR compliant.

Useful links:
WordPress GDPR
An Introduction to GDPR Compliance for WooCommerce Stores
The EU General Data Protection Regulation 

The code below allows you to add an extra WordPress WooCommerce ‘privacy policy’ link and an extra text label on the checkout page

/**
 *
 * Add terms and policy check box in checkout page
 */
if ( ! function_exists( 'ns_add_terms_and_policy' ) ) {
function ns_add_terms_and_policy() {
    $button_text = __( 'Privacy Policy', 'woocommerce' );
    $button_link = home_url( '/privacy-policy-and-cookies/' );
    $button = '<a href="' . $button_link . '" target="_blank">' . $button_text . '</a>';
    $message = sprintf( __( 'I have read and accept the %s and understand how you manage my Data under GDPR', 'woocommerce' ), $button );
    ?>
    <p class="form-row terms wc-terms-and-policy">
        <label class="woocommerce-form__label woocommerce-form__label-for-checkbox checkbox">
            <input type="checkbox" class="woocommerce-form__input woocommerce-form__input-checkbox input-checkbox" name="terms2"  id="terms2" /> <span><?php echo $message ?></span> <span class="required">*</span>
        </label>
        <input type="hidden" name="terms2-field" value="1" />
    </p>
    <?php
}
add_action( 'woocommerce_checkout_after_terms_and_conditions', 'ns_add_terms_and_policy', 20 );
}

/**
 *
 * Validate required terms and policy check box
 */
if ( ! function_exists( 'ns_terms_and_policy_validation' ) ) {
add_action( 'woocommerce_checkout_process', 'ns_terms_and_policy_validation', 20 );
function ns_terms_and_policy_validation() {
    if ( ! isset( $_POST[ 'terms2' ] ) ) {
        $text = __( 'Privacy Policy', 'woocommerce' );
        $message = sprintf( __( 'I have read and accept the %s and understand how you manage my Data under GDPR', 'woocommerce' ), $text );
        wc_add_notice( sprintf( __( 'You must accept "%s".', 'woocommerce' ), $message ), 'error' );
    }
}
}

ABOUT AUTHOR

Nuno

Hi, I'm a Freelance Web Developer and WordPress Expert based in London with a wealth of website development and support experience. I am great at problem solving and developing quick solutions.