@@ -83,13 +83,6 @@ class WooTab extends WC_Settings_Page implements Hookable {
8383 */
8484 const ALLOW_HISTORICAL_CUSTOMER_IMPORT_FIELD = 'cc_woo_customer_data_allow_import ' ;
8585
86- /**
87- * Store has user consent field.
88- *
89- * @since 2019-03-12
90- */
91- const STORE_AFFIRMS_CONSENT_TO_MARKET_FIELD = 'cc_woo_customer_data_opt_in_consent ' ;
92-
9386 /**
9487 * Settings section ID.
9588 *
@@ -176,7 +169,6 @@ public function register_hooks() {
176169 // Form.
177170 add_filter ( 'pre_option_ ' . self ::CURRENCY_FIELD , 'get_woocommerce_currency ' );
178171 add_filter ( 'pre_option_ ' . self ::COUNTRY_CODE_FIELD , [ $ this , 'get_woo_country ' ] );
179- add_filter ( 'pre_update_option_ ' . self ::ALLOW_HISTORICAL_CUSTOMER_IMPORT_FIELD , [ $ this , 'maybe_prevent_importing ' ] );
180172 add_filter ( 'woocommerce_admin_settings_sanitize_option_ ' . self ::PHONE_NUMBER_FIELD , [ $ this , 'sanitize_phone_number ' ] );
181173 add_filter ( "woocommerce_get_settings_ {$ this ->id }" , [ $ this , 'maybe_add_connection_button ' ] );
182174 add_action ( 'woocommerce_admin_field_cc_connection_button ' , [ $ this , 'add_cc_connection_button ' ] );
@@ -513,9 +505,10 @@ private function get_customer_data_settings() {
513505 'desc ' => esc_html__ ( 'All contacts must agree to receive marketing messages in order to be added to your mailing list. Therefore, when you import contacts, you are agreeing that you have permission to send them marketing messages. ' , 'cc-woo ' ),
514506 ],
515507 [
516- 'title ' => esc_html__ ( 'Do you have permission to send to the contacts you wish to import? ' , 'cc-woo ' ),
508+ 'title ' => esc_html__ ( 'Import historical customer data ' , 'cc-woo ' ),
509+ 'desc ' => esc_html__ ( 'Selecting Yes here will enable the ability to import your historical customer information to Constant Contact. ' , 'cc-woo ' ),
517510 'type ' => 'select ' ,
518- 'id ' => self ::STORE_AFFIRMS_CONSENT_TO_MARKET_FIELD ,
511+ 'id ' => self ::ALLOW_HISTORICAL_CUSTOMER_IMPORT_FIELD ,
519512 'default ' => '' ,
520513 'custom_attributes ' => [
521514 'required ' => true ,
@@ -532,69 +525,14 @@ private function get_customer_data_settings() {
532525 'id ' => 'anti-spam-notice ' ,
533526 ],
534527 [
535- 'title ' => esc_html__ ( 'Import historical customer data ' , 'cc-woo ' ),
536- 'desc ' => esc_html__ ( 'Selecting Yes here will enable the ability to import your historical customer information to Constant Contact. ' , 'cc-woo ' ),
537- 'type ' => 'select ' ,
538- 'id ' => self ::ALLOW_HISTORICAL_CUSTOMER_IMPORT_FIELD ,
539- 'default ' => '' ,
540- 'custom_attributes ' => [
541- 'required ' => true ,
542- ],
543- 'options ' => [
544- '' => '---- ' ,
545- 'false ' => esc_html__ ( 'No ' , 'cc-woo ' ),
546- 'true ' => esc_html__ ( 'Yes ' , 'cc-woo ' ),
547- ],
528+ 'type ' => 'sectionend ' ,
529+ 'id ' => 'cc_woo_customer_data_settings ' ,
548530 ],
549531 ];
550532
551- if ( $ this ->store_owner_confirmed_customer_consent_to_market () ) {
552- $ settings [] = [
553- 'id ' => 'cc_woo_customer_data_opt_in_import ' ,
554- 'type ' => 'button ' ,
555- 'title ' => esc_html__ ( 'Import Customer Data ' , 'cc-woo ' ),
556- ];
557- }
558-
559- $ settings [] = [
560- 'type ' => 'sectionend ' ,
561- 'id ' => 'cc_woo_customer_data_settings ' ,
562- ];
563-
564533 return $ settings ;
565534 }
566535
567- /**
568- * Check whether a store owner has confirmed they have customer consent to market to them.
569- *
570- * @author Jeremy Ward <[email protected] > 571- * @since 2019-03-14
572- * @return bool
573- */
574- private function store_owner_confirmed_customer_consent_to_market () {
575- return 'true ' === get_option ( self ::STORE_AFFIRMS_CONSENT_TO_MARKET_FIELD );
576- }
577-
578- /**
579- * Prevent importing if opt-in consent is not "Yes".
580- *
581- * @since 2019-03-08
582- * @author Zach Owen <zach@webdevstudios>
583- *
584- * @param mixed $value The value being set for the import option.
585- *
586- * @return string
587- */
588- public function maybe_prevent_importing ( $ value ) {
589- $ opt_in_consent = get_option ( self ::STORE_AFFIRMS_CONSENT_TO_MARKET_FIELD );
590-
591- if ( 'false ' === $ opt_in_consent ) {
592- return 'false ' ;
593- }
594-
595- return $ value ;
596- }
597-
598536 /**
599537 * Displays the Constant Contact connection button when the form is validated and a connection is not already established.
600538 *
0 commit comments