i som additional checks when user has submitted order in woocommerce. have tried using different add_filter methods, seems can't hook place_order filter. have tried with:
add_filter('woocommerce_place_order', 'checkfields'); //on ordersubmit function checkfields(){ if($this != true){ //not allowed place order because of data not true }else{ //continue order } }
but non of above being triggered when submit checkout form. suggestions? :)
try this..
add_action('woocommerce_after_checkout_validation', 'rei_after_checkout_validation'); function rei_after_checkout_validation( $posted ) { // logics here... // adding wc_add_notice second parameter of "error" stop form... // wc_add_notice( __( "omg! you're not human!", 'woocommerce' ), 'error' ); if (empty($_post['captcha'])) { wc_add_notice( __( "captcha empty!", 'woocommerce' ), 'error' ); } }
$posted
array this..
array ( [terms] => 0 [createaccount] => 0 [payment_method] => cheque [shipping_method] => [ship_to_different_address] => [billing_first_name] => [billing_last_name] => [billing_company] => [billing_email] => iamhuman@gmail.com [billing_phone] => [billing_country] => ph [billing_address_1] => [billing_address_2] => [billing_city] => [billing_state] => [billing_postcode] => [order_comments] => )
Comments
Post a Comment