admin管理员组文章数量:1332377
I am creating a plugin to send a one time password (OTP) to the user when the place order button is clicked. When the user clicks the button, the number from the phone number field must be captured and an API must be called to send the OTP. After that, a page with an input text box to enter the OTP must be present. If the user doesn't verify the order with the OTP, it must not be placed.
I am unable to find any hook to place such a textbox area and for the order placing.
I am creating a plugin to send a one time password (OTP) to the user when the place order button is clicked. When the user clicks the button, the number from the phone number field must be captured and an API must be called to send the OTP. After that, a page with an input text box to enter the OTP must be present. If the user doesn't verify the order with the OTP, it must not be placed.
I am unable to find any hook to place such a textbox area and for the order placing.
Share Improve this question edited Jul 4, 2018 at 16:47 fuxia♦ 107k38 gold badges255 silver badges459 bronze badges asked Jun 14, 2018 at 11:20 HarikeshHarikesh 111 silver badge3 bronze badges 4- FYI, per memory wordpress questions aren't in scope with the site. – user9447 Commented Jun 14, 2018 at 13:47
- then what else are allowed in wordpress stackexcange site? – Harikesh Commented Jun 14, 2018 at 15:39
- wordpress theme, plugin and development or any questions pertaining to . – user9447 Commented Jun 14, 2018 at 16:32
- my doubt is regarding plugin development only – Harikesh Commented Jun 15, 2018 at 5:58
1 Answer
Reset to default 1You can use woocommerce_after_checkout_validation
for custom validation. Following snippet might be helpful for you.
//Action to validate
add_action('woocommerce_after_checkout_validation', 'after_checkout_otp_validation');
//The function
function after_checkout_otp_validation( $posted ) {
// you can use wc_add_notice with a second parameter as "error" to stop the order from being placed
if (error) {
wc_add_notice( __( "Incorrect OTP!", 'text-domain' ), 'error' );
}
}
本文标签: plugin developmenthow to add custom functionality after woocommerce place order button
版权声明:本文标题:plugin development - how to add custom functionality after woocommerce place order button 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742297470a2449021.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论