You 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' );
}
}
Related Posts:
- Woocommerce – Hide a Column in Cart Table
- How do I change the initial quantity of a product in woocommerce?
- Remove an action by extending class and replacing it
- WooCommerce change Tax Class programmatically when Recalculating an existing Order [closed]
- Hide one specific woocoomerce product
- how to retrieve post_id under woocommerce_add_to_cart_validation hook?
- woocommerce single product page hook not working
- Woocommerce: block user removing cart item
- Trigger a JavaScript function based on the data fetched from Woo commerce hook
- Difference Between Filter and Action Hooks?
- How many times will this code run? (or, how rich is grandma?)
- add_action hook for completely new post?
- WordPress Hook for user register
- Using filters and actions for plugin API?
- Explanation of the “posts_join” and “posts_fields” filter hooks?
- Why does do_action pass a blank string as the first parameter if no $arg is set?
- What’s the difference between hooks, filters and actions? [duplicate]
- product-attribute-slug-is-too-long-28-characters-max
- How to check if certain plugin exists and in expected version
- How can I hook into existing WordPress Bulk actions?
- Plugin vs Settings load order (woocommerce dependency)
- How do I hook a custom discount to change a WC_Order price total on WooCommerce?
- Earliest WP Hook to Safely and Reliably Redirect
- Is it possible to modify the media library admin screen?
- What function to hook for changes made in status and visibility of a post
- Add multiple shipping rates from add_rate function with custom ID
- Order of Operation for these three hooks
- Modifying values with add_action to be sent to db
- save_post hook not triggered in WP v3.6.1
- Hook into theme-switching later than `setup_theme`
- Plugin development: get_post_meta is not working [closed]
- Is it possible to delay execution of shortcode output callback?
- Hook to get image filename when it is uploaded
- How to display a message about updates in the plugin list
- Why my database table not created on activation?
- How to delete an user including data from custom database tables
- Act on user meta updated, but only once
- Is there any way to allow a plugin to write over a previous version?
- Should action callbacks start with a verb?
- Execute Hook on the footer or header after activating a plugin
- How to check if Woocommerce Order number equals to post ID?
- How do I add custom column to woocommerce cart?
- How plugins_loaded works?
- What filter should I use to insert a button inside on Media>Add New
- WooCommerce registration password field not displaying
- Conditional hook based on the core function that is calling it
- PHP – Extend WordPress Woocommerce Revenue Analytics with custom field
- Send push when new post is published in a certain category
- How can we display product price $104 on the cart while the credit card payment method is checked?
- How to extend WooCommerce API to show bookable product availability rules?
- Customize WooCommerce my account dashboard through plugin
- use of do_action() without any functions attached
- How to get all queries’s results after they have executed?
- Woocommerce order empty items array
- How to get all product in the woo-commerce? [closed]
- Odd map_meta_cap $args on post edit — sometimes integer, sometimes string
- How can I create a custom plugin that allows anonymous users to signup without registering?
- Bind a function with its own argument to show something dynamically after every content
- What’s the hook for filtering every texts of site?
- Hook add_attachment error
- Associate multiple email addresses with the same user account, so they can log in with either
- Can woocommerse be used dynamically for billing from another plugin for payment processing?
- Update variable value via add_filter
- Can we use a library under MIT license in a WooCommerce plugin?
- Custom filter not working
- hook update_option/updated_option empty $old_value and $value
- Configure WordPress to Generate Scheme-less Relative URLs
- Woocommerce – Provide Associated Category Link for Product List Plugin [closed]
- How to find list of all functions bind to a particular hook from my plugin?
- Remove Products From Category
- want to show CMB2 metabox on woocommerce product data tab
- Customise Grouped Product display in Woocommerce with custom column
- Creating posts with links from a txt file
- apply_filters() and call_user_func() to define and call a function outside a class
- Trying to run a Ajax request from a checkout form in woocommerce via a custom plugin
- Securing custom rest API endpoints with public access from PWA
- WooCommerce – Stop assigning order numbers
- Adding customs fields on each product on the cart
- Override woocommerce loop-start.php from theme using plugin?
- Pre-populated WooCommerce checkout fields: dropdown fields issue
- Problem in plugin debuging in wordpress
- WordPress Plugin Boilerplate – add actions and/or filters based on user’s role
- woocommerce wc_get_product is not fetching all the product of particular category
- OOP development and hooks
- How to trigger WooCommerce user profile edit change?
- WC_Geolocation not found inside plugin
- How to use functions from Woocommerce documentation?
- Add_action not calling callback function
- add_option_{$option} action hook not being called
- Function not working on any file other than the main plugin file
- Multi hook deploiement
- Woo-commerce: Adding additional page sections using a child theme
- How can I set a dynamic value for post_updated_messages based on return value of post_updated?
- What is the use of wp_schedule_event hook?
- Looking for Hook that is fired after a plugin or wp upgrade is installed/updated
- How to remove city field from order in dashboard?
- How to design WooCommerce-like admin tabs for plugin settings page?
- Insert plugin html content to a specific spot in the frontpage
- get_term_by() returning null on plugin
- Return custom product in ajax call loop