diff --git a/includes/Ajax.php b/includes/Ajax.php index 84c67ab67..0b41bdf45 100644 --- a/includes/Ajax.php +++ b/includes/Ajax.php @@ -46,7 +46,7 @@ public function __construct() { $this->register_ajax( 'wpuf_account_update_profile', [ new Frontend\Frontend_Account(), 'update_profile' ], $this->logged_in_only ); $this->register_ajax( 'wpuf_import_forms', [ new Admin\Admin_Tools(), 'import_forms' ], $this->logged_in_only ); $this->register_ajax( 'wpuf_get_child_cat', 'wpuf_get_child_cats' ); - $this->register_ajax( 'wpuf_ajax_address', 'wpuf_get_child_cats' ); + $this->register_ajax( 'wpuf_ajax_address', 'wpuf_ajax_get_states_field' ); $this->register_ajax( 'wpuf_update_billing_address', 'wpuf_update_billing_address' ); $this->register_ajax( 'wpuf_clear_schedule_lock', 'wpuf_clear_schedule_lock', $this->logged_in_only ); } diff --git a/includes/Frontend.php b/includes/Frontend.php index 8e5482485..4be192f76 100644 --- a/includes/Frontend.php +++ b/includes/Frontend.php @@ -139,7 +139,6 @@ public function enqueue_scripts() { ] ) ); - wp_localize_script( 'wpuf-frontend-form', 'error_str_obj', [ 'required' => __( 'is required', 'wp-user-frontend' ), @@ -147,6 +146,14 @@ public function enqueue_scripts() { 'validation' => __( 'is not valid', 'wp-user-frontend' ), ] ); + wp_localize_script( + 'wpuf-billing-address', + 'ajax_object', + [ + 'ajaxurl' => admin_url( 'admin-ajax.php' ), + 'fill_notice' => __( 'Some Required Fields are not filled!', 'wp-user-frontend' ), + ] + ); } } diff --git a/includes/Frontend/Frontend_Account.php b/includes/Frontend/Frontend_Account.php index 59ecc1d1f..0990194f7 100644 --- a/includes/Frontend/Frontend_Account.php +++ b/includes/Frontend/Frontend_Account.php @@ -280,10 +280,13 @@ public function edit_profile_section( $sections, $current_section ) { * @return void */ public function billing_address_section( $sections, $current_section ) { - wpuf_load_template( 'dashboard/billing-address.php', [ - 'sections' => $sections, - 'current_section' => $current_section, - ] ); + wpuf_load_template( + 'dashboard/billing-address.php', + [ + 'sections' => $sections, + 'current_section' => $current_section, + ] + ); } /** diff --git a/templates/dashboard/billing-address.php b/templates/dashboard/billing-address.php index 4255f8d4a..84ae7677e 100644 --- a/templates/dashboard/billing-address.php +++ b/templates/dashboard/billing-address.php @@ -8,7 +8,6 @@ if ( isset( $_POST['update_billing_address'] ) ) { - if ( ! isset( $_POST['wpuf_save_address_nonce'] ) || ! wp_verify_nonce( sanitize_key( $_POST['wpuf_save_address_nonce'] ), 'wpuf_address_ajax_action' ) ) { return; }