• Hi there,

    I’m using the following code to add a confirm password field to the checkout page. After the latest WordPress/Woocommerce updates this code seems to cause the Taxes tables, located in the Woocommerce admin settings, to stuck on “loading…”. Could you please help me to figure out what’s wrong? Thanks

    
    // ----- Validate confirm password field match to the checkout page
    function lit_woocommerce_confirm_password_validation( $posted ) {
        $checkout = WC()->checkout;
        if ( ! is_user_logged_in() && ( $checkout->must_create_account || ! empty( $posted['createaccount'] ) ) ) {
            if ( strcmp( $posted['account_password'], $posted['account_confirm_password'] ) !== 0 ) {
                wc_add_notice( __( 'Password not matching.', 'woocommerce' ), 'error' ); 
            }
        }
    }
    add_action( 'woocommerce_after_checkout_validation', 'lit_woocommerce_confirm_password_validation', 1, 2 );
    
    // ----- Add a confirm password field to the checkout page
    function lit_woocommerce_confirm_password_checkout( $checkout ) {
        if ( get_option( 'woocommerce_registration_generate_password' ) == 'no' ) {
    
            $fields = $checkout->get_checkout_fields();
    
            $fields['account']['account_confirm_password'] = array(
                'type'              => 'password',
                'label'             => __( 'Confirm password', 'woocommerce' ),
                'required'          => true,
                'placeholder'       => _x( 'Confirm Password', 'placeholder', 'woocommerce' )
            );
    
            $checkout->__set( 'checkout_fields', $fields );
        }
    }
    add_action( 'woocommerce_checkout_init', 'lit_woocommerce_confirm_password_checkout', 1, 1 );
    
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Gabriel – a11n

    (@gabrielfuentes)

    Hi there ??

    This is a fairly complex development topic. I’m going to leave it open for a bit to see if anyone is able to chime in to help you out.

    I can also recommend the WooCommerce Developer Resources Portal for resources on developing for WooCommerce.

    You can also visit the WooCommerce Facebook group or the #developers channel of the WooCommerce Community Slack. We’re lucky to have a great community of open-source developers for WooCommerce, and many of our developers hang out there, as well.

    Thread Starter head84

    (@head84)

    Hi Gabriel, thank you for getting back to me.

    After doing some more testing I realized this is the function causing my issues:

    
    $fields = $checkout->get_checkout_fields();
    

    The problem is not limited to the taxes tables; I’m facing different kind of issues in the admin side. Could you please give me some advice?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Adding confirm password field to the checkout page causes Taxes stuck on loading’ is closed to new replies.