Skip to content
Docs
Get RestroPress

Action

rpress_checkout_error_checks

Updated
On this page

Fires after the standard checkout validation so extensions can add their own errors.

Runs in rpress_process_purchase_form() after the posted fields, service type, service time and store opening hours have been validated. It only runs when the cart is not empty. Call rpress_set_error() from a callback to stop the order from being placed. RestroPress uses it to check that the email address is not already used by another customer.

Parameters#

ParameterTypeDescription
$valid_dataarray|falseValidated data from rpress_purchase_form_validate_fields(), or false when it failed or the request was empty.
$dataarraySanitized copy of $_POST.

Example#

add_action( 'rpress_checkout_error_checks', 'my_require_delivery_notes_ack', 10, 2 );
function my_require_delivery_notes_ack( $valid_data, $data ) {
	if ( empty( $data['my_notes_ack'] ) ) {
		rpress_set_error( 'my_notes_ack', __( 'Please confirm the delivery notes.', 'my-plugin' ) );
	}
}

Notes#

Fires on both the AJAX validation request and the final submission.

Source#

Fired from:

  • includes/process-purchase.php (line 126), in rpress_process_purchase_form()

See also#

Was this page helpful?