Filter
rpress_proceed_checkout
On this page
Filters the response returned when the customer proceeds to checkout.
Runs in the proceed_checkout AJAX handler after rpress_pre_validate_order() has validated the cart and service type. The returned value is sent to the browser with wp_send_json(). Use it to add checks, such as blocking checkout under custom conditions, or to attach extra data for the front-end script.
Parameters#
| Parameter | Type | Description |
|---|---|---|
$response | array | Validation result from rpress_pre_validate_order(), typically containing a status key and, on failure, error_type and error_msg. |
Return value#
array. The response array sent as JSON.
Example#
function my_proceed_checkout( $response ) {
if ( isset( $response['status'] ) && 'error' !== $response['status'] && rpress_get_cart_quantity() > 20 ) {
$response = array(
'status' => 'error',
'error_msg' => __( 'Orders are limited to 20 items.', 'my-plugin' ),
);
}
return $response;
}
add_filter( 'rpress_proceed_checkout', 'my_proceed_checkout' );
Source#
Applied in:
includes/class-rpress-ajax.php(line 1254), inRP_AJAX::proceed_checkout()
See also#
Was this page helpful?
