Created
March 26, 2019 12:05
-
-
Save damiencarbery/0d94c92f315309bbef740911b68328a6 to your computer and use it in GitHub Desktop.
Patch for Abandoned Cart Lite for WooCommerce - https://wordpress.org/support/topic/gdpr-email-message-in-checkout-required-fields-list/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- 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(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment