woocommerce / woocommerce-gateway-paypal-express-checkout

58 stars 65 forks source link

Custom Fields are checked after Customer enters PayPal #857

Open Fiorinol opened 3 years ago

Fiorinol commented 3 years ago

This plugin seems to only check the woocommerce_checkout_process hook when the customer clicks on "Pay Now" inside Paypal's interface, and not before the user goes onto Paypal like with default fields. This is bothersome as the customer goes through the entire process and gets thrown back into checkout when they're done entering all their payment information/logging into PayPal.

I have custom fields created from woocommerce_form_field, and I validate them as thus:

add_action('woocommerce_checkout_process', 'my_validation');

function my_validation() {
    wc_clear_notices();

    if ( empty( $_POST['field_1']) ){
        wc_add_notice( "Please Enter Field 1.", 'error' );
    }

    if ( empty( $_POST['field_2']) ){
        wc_add_notice( "Please Enter Field 2.", 'error');
    }

}

The behavior that I expect is that it gets checked at the same time as the other fields, as this is the recommended way to handle custom fields as per WooCommerce: https://docs.woocommerce.com/document/tutorial-customising-checkout-fields-using-actions-and-filters/

Environment (please complete the following information):

addedlovely commented 3 years ago

+1 Came across this today.

jorgeatorres commented 3 years ago

From #807:

I am using Paypal Express checkout, I am only having Paypal checkout on Checkout page also I am skipping the cart. I have minimum order amount Error messages based on Customer postcode input, this works fine for default Paypal checkout. But we prefer to use Paypal Express checkout. Paypal express won't let the user to enter Paypal page if the minimum order amount is not reached, that's perfectly working, but our custom message is not getting display, only alert mark and red line is appearing.

Environment (please complete the following information):

WordPress Version - 5.4.2
WooCommerce Version - Version 3.7.0
PayPal (Express) Checkout Plugin Version - Version 2.0.3
Browser [e.g. chrome, safari] and Version - Chrome
aadigital2020 commented 2 years ago

+1 Encountered this with a shipping method that hooks into woocommerce_checkout_process and the validation isn't performed until the user clicks Pay Now.