Skip to content

Commit

Permalink
fix: state field is not changing
Browse files Browse the repository at this point in the history
Options in State field is not changing according to the selected Country while setting up billing address
  • Loading branch information
sapayth committed Aug 13, 2024
1 parent 70a40c7 commit 2fa2055
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 7 deletions.
2 changes: 1 addition & 1 deletion includes/Ajax.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
}
Expand Down
9 changes: 8 additions & 1 deletion includes/Frontend.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,14 +139,21 @@ public function enqueue_scripts() {
]
)
);

wp_localize_script(
'wpuf-frontend-form', 'error_str_obj', [
'required' => __( 'is required', 'wp-user-frontend' ),
'mismatch' => __( 'does not match', 'wp-user-frontend' ),
'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' ),
]
);
}
}

Expand Down
11 changes: 7 additions & 4 deletions includes/Frontend/Frontend_Account.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
]
);
}

/**
Expand Down
1 change: 0 additions & 1 deletion templates/dashboard/billing-address.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 2fa2055

Please sign in to comment.