• Resolved daymobrew

    (@daymobrew)


    On the Checkout page, if the customer does not enter an email address (or other required field) then WooCommerce will list the required fields at the top of the page.

    The “Your email address will help us support your shopping experience throughout the site. Please check our Privacy Policy to see how we use your personal data.” message is appended to the “Billing Email address” field name. This looks bad.
    Screenshot: https://imgur.com/a/lIfXeLZ

    I have two ideas to solve this:
    1) Modify Wcal_Tracking_msg class to store the original and modified $fields[ ‘billing’ ][ ‘billing_email’ ][ ‘label’ ] in member variables.
    Then add_filter for ‘woocommerce_checkout_required_field_notice’ to change the message when $field_label is the modified $fields[ ‘billing’ ][ ‘billing_email’ ][ ‘label’ ]. Do a str_replace() of the modified text with the original text.
    2) In the ‘woocommerce_checkout_required_field_notice’ check for the ‘wcal_guest_cart_capture_msg’ text and remove it if found. It wouldn’t be a big deal to call str_replace() each time ‘woocommerce_checkout_required_field_notice’ is called.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter daymobrew

    (@daymobrew)

    I added a new function to includes/wcal_data_tracking_message.php to remove the GDPR message from the WooCommerce required field error message.

    https://gist.github.com/damiencarbery/0d94c92f315309bbef740911b68328a6

    — includes/wcal_data_tracking_message.orig.php 2018-11-01 13:18:12.000000000 +0000
    +++ includes/wcal_data_tracking_message.php 2019-03-26 12:01:14.853387900 +0000
    @@ -24,6 +24,9 @@
    // Shop Page notice
    add_action( ‘woocommerce_before_shop_loop’, array( &$this, ‘wcal_add_logged_msg’ ), 10 );
    //add_action( ‘woocommerce_after_shop_loop_item’, array( &$this, ‘wcal_add_logged_msg’ ), 10 );
    +
    + // Checkout page required field filter
    + add_action( ‘woocommerce_checkout_required_field_notice’, array( &$this, ‘wcal_remove_gdpr_msg’ ), 10, 2 );
    }

    /**
    @@ -68,6 +71,29 @@
    }
    }
    }
    +
    + /**
    + * Remove the extra Billing_email text from the required field error message.
    + * Called on Checkout page
    + *
    + * @hook woocommerce_checkout_required_field_notice
    + *
    + * @since 5.2.2
    + */
    + static function wcal_remove_gdpr_msg( $message, $field_label ) {
    + if ( ! is_user_logged_in() ) {
    + // check if any message is present in the settings
    + $guest_msg = get_option( ‘wcal_guest_cart_capture_msg’ );
    +
    + if ( isset( $guest_msg ) && ” != $guest_msg ) {
    + $guest_msg = esc_html( “<br><small>$guest_msg</small>” );
    + if ( false !== strpos( $message, $guest_msg ) ) {
    + $message = str_replace( $guest_msg, ”, $message );
    + }
    + }
    + }
    + return $message;
    + }

    } // end of class
    $Wcal_Tracking_msg = new Wcal_Tracking_msg();

    Plugin Support priyankajagtap

    (@priyankajagtap)

    Hi @daymobrew,

    Thank you for proving the solution.

    I agree that we should not show that message. I have added that issue in our issues list and will check whether we can remove it from our plugin and will fix in the next plugin update.

    Let us know if you hve any questions.

    Regards,
    Priyanka Jagtap

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘GDPR email message in checkout required fields list’ is closed to new replies.