mardi 28 juin 2016

Error on checkout - Wordpress

I have this extremely strange error that only happens when people try to order. Guests come onto our site and add stuff to their cart. Then they proceed to go to the checkout. On checkout when they click proceed to paypal they get the following error: "We were unable to process your order, please try again.". However on reloading the page the error is gone when they try to recheckout. No plugins or themes are conflicting as I checked all of them.

I did some debugging and I noticed that the reason the error is thrown is because of the function: wp_verify_nonce() I did some further debuging and found out that during the first time the user tries to checkout the above function is called. And returns false because the nonce is different when compared to what is currently hashed. However on the second checkout the above function returns true because the nonce is correct. This means that for some reason my nonce is wrong the first time. Does anyone know why?

I'm getting this problem on the following function: process_checkout() When the following command is run:

if ( empty( $_POST['_wpnonce'] ) || ! wp_verify_nonce( $_POST['_wpnonce'], 'woocommerce-process_checkout' )) {
            WC()->session->set( 'refresh_totals', true );
            throw new Exception( __( 'We were unable to process your order, please try again.', 'woocommerce' ) );
        }

I tried my best to explain my issue but does anyone know why my nonce is wrong during checkout on the first time?



via Chebli Mohamed

1 commentaire:

  1. Hi,
    I'm getting the same issue.
    Have you find how to fix it ?
    Thanks !

    RépondreSupprimer