Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Contributor Mike Jolley

    (@mikejolley)

    Read here https://codex.www.ads-software.com/WordPress_Nonces this is not woocommerce specific.

    Thread Starter Karolina Vyskocilova

    (@vyskoczilova)

    Hi @mike, thanks, however, I was looking for some WooCommerce specific answer. I had to dig into the code myself, and the correct one is that your plugin checks the nonces before calling this “do action” so no custom nonces for this action is not needed.

    woocommerce/includes/class-wc-checkout.php

    used action is at line 366:

    do_action( 'woocommerce_checkout_process' );

    and before doing this action, there is verified WooCommerce nonce, lines 348-351

    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' ) );
                }
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to add nonces to add_action’ is closed to new replies.