Skip to content
Docs
Get RestroPress

Action

rpress_checkout_before_gateway

Updated
On this page

Fires after checkout validation, just before the order is sent to the payment gateway.

Runs in rpress_process_purchase_form() on the final (non-AJAX) submission, after validation has passed and the user, customer record and purchase data have been prepared, and before the purchase data is filtered by rpress_purchase_data_before_gateway and handed to rpress_send_to_gateway(). $valid_data already contains the resolved user under the 'user' key.

Parameters#

ParameterTypeDescription
$dataarraySanitized copy of $_POST.
$user_infoarrayUser info with 'id', 'email', 'first_name', 'last_name', 'discount' and 'address'.
$valid_dataarrayValidated data, with the resolved user added under 'user'.

Example#

add_action( 'rpress_checkout_before_gateway', 'my_store_checkout_email', 10, 3 );
function my_store_checkout_email( $data, $user_info, $valid_data ) {
	if ( ! empty( $user_info['id'] ) ) {
		update_user_meta( $user_info['id'], 'my_last_checkout_email', $user_info['email'] );
	}
}

Notes#

Not fired for the AJAX validation request, which ends with 'success' before this point.

Source#

Fired from:

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

See also#

Was this page helpful?