woocommerce / woocommerce-paypal-payments

https://wordpress.org/plugins/woocommerce-paypal-payments/
GNU General Public License v2.0
62 stars 47 forks source link

Asking for address fields in checkout when i don't use them - Version 2.0.1 (1354) #1089

Closed Bebuk85 closed 1 year ago

Bebuk85 commented 1 year ago

Hi there, i think this update is messing with my settings, i'm using Woofunnel builder (Funnel Kit now), it creates a new checkout form, i'm not using address fields for my checkout because i don't need it, but this update screw up my checkout form, Is there anything to fix this?

no address fields for me need it

I think this is the reason of my problem https://github.com/woocommerce/woocommerce-paypal-payments/pull/1047

AlexP11223 commented 1 year ago

You can disable this validation for now.

add_filter('woocommerce_paypal_payments_early_wc_checkout_validation_enabled', '__return_false');
badpenguin commented 1 year ago

Same problems here! We only process order with First Name, Last Name, Email, Country & State. No need for Address and phone number. Its disabled in WC trough filters. But in the latest version those settings are ignored.

This is the code that you find on many website as example:

function child_filter_default_address_fields( $address_fields ) {
    if ( ! is_checkout() ) {
        return $address_fields;
    }

    // All field keys in this array
    $key_fields = array(
        'company',
        'address_1',
        'address_2',
        'city',
        'state',
        'postcode'
    );

    // Loop through each address fields (billing and shipping)
    foreach ( $key_fields as $key_field ) {
        $address_fields[ $key_field ]['required'] = false;
    }
    return $address_fields;
}
add_filter( "woocommerce_default_address_fields", "child_filter_default_address_fields", 20 );

function child_woocommerce_billing_fields( $fields ) {
    if ( ! is_checkout() ) {
        return $fields;
    }

    unset( $fields['billing_company'] );
    unset( $fields['billing_address_1'] );
    unset( $fields['billing_address_2'] );
    unset( $fields['billing_city'] );
    unset( $fields['billing_phone'] );
    unset( $fields['billing_postcode'] );
    return $fields;
}
add_filter( 'woocommerce_billing_fields', 'child_woocommerce_billing_fields', 99, 1 );
InpsydeNiklas commented 1 year ago

Thanks for the feedback. The validation behavior will be improved further with the next update(s). The use case with unset fields should be fixed for the update later in January.

Dinamiko commented 1 year ago

Fixed in #1144.