WooCommerce Code Reference

WC_Form_Handler
in package

WC_Form_Handler class.

Table of Contents

add_payment_method_action()  : mixed
Process the add payment method form.
add_to_cart_action()  : mixed
Add to cart action.
cancel_order()  : mixed
Cancel a pending order.
checkout_action()  : mixed
Process the checkout form.
delete_payment_method_action()  : mixed
Process the delete payment method form.
init()  : mixed
Hook in methods.
order_again()  : mixed
Place a previous order again.
pay_action()  : mixed
Process the pay form.
process_login()  : mixed
Process the login form.
process_lost_password()  : mixed
Handle lost password form.
process_registration()  : mixed
Process the registration form.
process_reset_password()  : mixed
Handle reset password form.
redirect_reset_password_link()  : mixed
Remove key and user ID (or user login, as a fallback) from query string, set cookie, and redirect to account page to show the form.
save_account_details()  : mixed
Save the password/account details and redirect back to the my account page.
save_address()  : mixed
Save and and update a billing or shipping address if the form was submitted through the user account page.
set_default_payment_method_action()  : mixed
Process the delete payment method form.
update_cart_action()  : mixed
Remove from cart/update.
add_to_cart_handler_grouped()  : bool
Handle adding grouped products to the cart.
add_to_cart_handler_simple()  : bool
Handle adding simple products to the cart.
add_to_cart_handler_variable()  : bool
Handle adding variable products to the cart.

Methods

add_payment_method_action()

Process the add payment method form.

public static add_payment_method_action() : mixed
Return values
mixed

add_to_cart_action()

Add to cart action.

public static add_to_cart_action([bool $url = false ]) : mixed

Checks for a valid request, does validation (via hooks) and then redirects if valid.

Parameters
$url : bool = false

(default: false) URL to redirect to.

Return values
mixed

delete_payment_method_action()

Process the delete payment method form.

public static delete_payment_method_action() : mixed
Return values
mixed

order_again()

Place a previous order again.

public static order_again() : mixed
Tags
deprecated
3.5.0

Logic moved to cart session handling.

Return values
mixed

pay_action()

Process the pay form.

public static pay_action() : mixed
Tags
throws
Exception

On payment error.

Return values
mixed

process_login()

Process the login form.

public static process_login() : mixed
Tags
throws
Exception

On login error.

Return values
mixed

process_registration()

Process the registration form.

public static process_registration() : mixed
Tags
throws
Exception

On registration error.

Return values
mixed

Remove key and user ID (or user login, as a fallback) from query string, set cookie, and redirect to account page to show the form.

public static redirect_reset_password_link() : mixed
Return values
mixed

save_account_details()

Save the password/account details and redirect back to the my account page.

public static save_account_details() : mixed
Return values
mixed

save_address()

Save and and update a billing or shipping address if the form was submitted through the user account page.

public static save_address() : mixed
Return values
mixed

set_default_payment_method_action()

Process the delete payment method form.

public static set_default_payment_method_action() : mixed
Return values
mixed

add_to_cart_handler_grouped()

Handle adding grouped products to the cart.

private static add_to_cart_handler_grouped(int $product_id) : bool
Parameters
$product_id : int

Product ID to add to the cart.

Tags
since
2.4.6

Split from add_to_cart_action.

Return values
boolsuccess or not

add_to_cart_handler_simple()

Handle adding simple products to the cart.

private static add_to_cart_handler_simple(int $product_id) : bool
Parameters
$product_id : int

Product ID to add to the cart.

Tags
since
2.4.6

Split from add_to_cart_action.

Return values
boolsuccess or not

add_to_cart_handler_variable()

Handle adding variable products to the cart.

private static add_to_cart_handler_variable(int $product_id) : bool
Parameters
$product_id : int

Product ID to add to the cart.

Tags
since
2.4.6

Split from add_to_cart_action.

throws
Exception

If add to cart fails.

Return values
boolsuccess or not