CartCheckout extends AbstractCart
in package

Cart Checkout Route

Processes checkout from cart for express payment methods

Tags
since
4.0.0

Table of Contents

Properties

$payment_method  : WC_Payment_Gateway_Stripe
$request  : WP_REST_Request

Methods

filter_posted_data()  : array<string|int, mixed>
Filter checkout posted data
get_error_response()  : WP_Error
Convert exceptions/WP_Error to error responses
get_full_path()  : string
Get full path including namespace
get_namespace()  : string
Get the route namespace
get_path()  : string
Get the route path
get_routes()  : array<string|int, mixed>
Get route configuration
handle_checkout_validation()  : mixed
Handle checkout validation errors
handle_delete_request()  : mixed
Handle DELETE request
handle_get_request()  : mixed
Handle GET request
handle_post_request()  : void
Handle POST request - Process checkout
handle_put_request()  : mixed
Handle PUT request
handle_request()  : WP_REST_Response|WP_Error
Handle REST request
validate_payment_method()  : bool
Validate payment method
calculate_totals()  : void
Calculate cart totals
clear_cached_shipping_rates()  : void
Clear cached shipping rates
get_payment_method_from_request()  : WC_Payment_Gateway|null
Get payment gateway from request
get_wc_notice()  : string
Get WooCommerce notice
populate_post_data()  : mixed
Populate $_POST and $_REQUEST with request data
apply_product_gateway_options()  : mixed
Apply product-specific gateway options
create_customer()  : mixed
Create customer account for guest users
get_order_review_url()  : string
Get order review URL with encoded payment data
initialize()  : mixed
Initialize hooks for checkout processing
prepare_request_params()  : mixed
Prepare and normalize request parameters
set_required_fields()  : mixed
Set required POST fields for checkout

Properties

Methods

filter_posted_data()

Filter checkout posted data

public filter_posted_data(array<string|int, mixed> $data) : array<string|int, mixed>
Parameters
$data : array<string|int, mixed>

Posted checkout data

Return values
array<string|int, mixed>

get_error_response()

Convert exceptions/WP_Error to error responses

public get_error_response(Exception|WP_Error $error) : WP_Error
Parameters
$error : Exception|WP_Error
Return values
WP_Error

handle_checkout_validation()

Handle checkout validation errors

public handle_checkout_validation(array<string|int, mixed> $data, WP_Error $errors) : mixed
Parameters
$data : array<string|int, mixed>

Posted data

$errors : WP_Error

Validation errors

handle_delete_request()

Handle DELETE request

public handle_delete_request(WP_REST_Request $request) : mixed
Parameters
$request : WP_REST_Request
Tags
throws
Exception

handle_get_request()

Handle GET request

public handle_get_request(WP_REST_Request $request) : mixed
Parameters
$request : WP_REST_Request
Tags
throws
Exception

handle_post_request()

Handle POST request - Process checkout

public handle_post_request(WP_REST_Request $request) : void
Parameters
$request : WP_REST_Request

handle_put_request()

Handle PUT request

public handle_put_request(WP_REST_Request $request) : mixed
Parameters
$request : WP_REST_Request
Tags
throws
Exception

handle_request()

Handle REST request

public handle_request(WP_REST_Request $request) : WP_REST_Response|WP_Error

Routes to appropriate method handler based on HTTP method

Parameters
$request : WP_REST_Request
Return values
WP_REST_Response|WP_Error

validate_payment_method()

Validate payment method

public validate_payment_method(string $payment_method, WP_REST_Request $request) : bool
Parameters
$payment_method : string

Payment method ID

$request : WP_REST_Request

Request object

Return values
bool

clear_cached_shipping_rates()

Clear cached shipping rates

protected clear_cached_shipping_rates() : void

Forces WooCommerce to recalculate shipping rates

get_payment_method_from_request()

Get payment gateway from request

protected get_payment_method_from_request(WP_REST_Request $request) : WC_Payment_Gateway|null
Parameters
$request : WP_REST_Request
Return values
WC_Payment_Gateway|null

get_wc_notice()

Get WooCommerce notice

protected get_wc_notice([string $notice_type = '' ][, string $default = '' ]) : string
Parameters
$notice_type : string = ''

Notice type (error, success, notice)

$default : string = ''

Default message if no notice found

Return values
string

populate_post_data()

Populate $_POST and $_REQUEST with request data

protected populate_post_data(WP_REST_Request $request) : mixed

Some 3rd party plugins depend on $_POST being populated

Parameters
$request : WP_REST_Request

create_customer()

Create customer account for guest users

private create_customer(WP_REST_Request $request) : mixed
Parameters
$request : WP_REST_Request
Tags
throws
Exception

prepare_request_params()

Prepare and normalize request parameters

private prepare_request_params(WP_REST_Request $request) : mixed
Parameters
$request : WP_REST_Request

        
On this page

Search results