-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Do not validate checkout form when creating PayPal order #341
Conversation
But what was the reason to call it twice? Is everything still working? Looks like we do not have WC validation now before creating the order here, is it ok? |
The reason to call Here is how it currently works;
which defines We are not validating WC checkout form when creating the PayPal order on other pages like Single product or Cart, that´s the reason I proposed this solution, it does separate PayPal order creation from WC order creation. It also opens the door for writing our own PayPal specific validation for order creation.
For what it tested so far it works, but we´ll need to do more acceptance to ensure nothing is broken for all cases.
For creating the PayPal order we are not going to have WC checkout form validation now but it still does validation when creating the WC order: |
…ments into PCP-375-order-of-woocommerce-checkout-ac
Fixes #335.
Possible cause
We are currently calling WC
process_checkout
twice, the first time it's called before creating the PayPal order to validate WC checkout form.This is causing third party plugins not working because they are using
woocommerce_after_checkout_validation
for validating its own logic and after that cleaning session data onwoocommerce_checkout_order_processed
, when our plugin callsprocess_checkout
the second time it calls againwoocommerce_after_checkout_validation
making it fail because there is no session stored available, it was already cleared onwoocommerce_checkout_order_processed
.Suggested solution
We can simply skip WC checkout form validation when creating the PayPal order, that's in fact how it works when we create the PayPal order from other pages like Product or Cart.
By not calling
process_checkout
when creating the PayPal order we are going to probably also fix some of those WC Failed orders because the WC order is going to be created only after PayPal order is created correctly and WC checkout form is validated.