Skip to content
Docs
Get RestroPress

Filter

rpress_purchase_data_before_gateway

Updated
On this page

Filters the purchase data array just before it is handed to the payment gateway.

Runs in the checkout form handler after the user and customer records have been resolved and the rpress_checkout_before_gateway action has fired. If the cart total is zero, the gateway has already been switched to manual at this point. The array holds the cart contents, totals, purchase key, user information and the selected gateway. The returned array is saved to the purchase session and passed to rpress_send_to_gateway() for the selected gateway.

Parameters#

ParameterTypeDescription
$purchase_dataarrayPurchase data with keys such as fooditems, fees, subtotal, discount, tax, tax_rate, price, purchase_key, user_email, date, user_info, post_data, cart_details, gateway and card_info.
$valid_dataarrayValidated checkout data, including gateway, cc_info and the resolved user in the user key.

Return value#

array. The (possibly modified) purchase data.

Example#

function my_normalize_purchase_email( $purchase_data, $valid_data ) {
	$purchase_data['user_email'] = strtolower( $purchase_data['user_email'] );
	return $purchase_data;
}
add_filter( 'rpress_purchase_data_before_gateway', 'my_normalize_purchase_email', 10, 2 );

Source#

Applied in:

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

See also#

Was this page helpful?