Add_To_Cart_Route extends Base_Route implements Registerable
REST handler for the 'add to cart' route.
Tags
Interfaces, Classes and Traits
- Registerable
Table of Contents
- $rest_base : mixed
- add_to_cart() : mixed
- register() : mixed
- add_products_to_cart() : mixed
- add_single_product_to_cart() : mixed
- get_add_to_cart_message() : mixed
- Custom add to cart message for the Quick View.
- validate_add_to_cart_params() : mixed
- check_prerequisites() : mixed
- Check any prerequisites required for our add to cart request.
- get_add_to_cart_fragments() : mixed
- get_add_to_cart_hash() : mixed
- get_submitted_variations() : mixed
Properties
$rest_base
protected
mixed
$rest_base
= 'cart'
Methods
add_to_cart()
public
add_to_cart(WP_REST_Request $request) : mixed
Parameters
- $request : WP_REST_Request
Return values
mixed —register()
public
register() : mixed
Return values
mixed —add_products_to_cart()
protected
add_products_to_cart(mixed $cart_products) : mixed
Parameters
- $cart_products : mixed
Return values
mixed —add_single_product_to_cart()
protected
add_single_product_to_cart(mixed $product_id, mixed $quantity, mixed $variation_id[, mixed $variations = [] ]) : mixed
Parameters
- $product_id : mixed
- $quantity : mixed
- $variation_id : mixed
- $variations : mixed = []
Return values
mixed —get_add_to_cart_message()
Custom add to cart message for the Quick View.
protected
get_add_to_cart_message(int|array<string|int, mixed> $products[, bool $show_qty = false ]) : mixed
Parameters
- $products : int|array<string|int, mixed>
-
Product ID list or single product ID.
- $show_qty : bool = false
-
Should qty's be shown? Added in 2.6.0.
Return values
mixed —validate_add_to_cart_params()
protected
validate_add_to_cart_params(mixed $params) : mixed
Parameters
- $params : mixed
Return values
mixed —check_prerequisites()
Check any prerequisites required for our add to cart request.
private
check_prerequisites() : mixed
Return values
mixed —get_add_to_cart_fragments()
private
get_add_to_cart_fragments() : mixed
Return values
mixed —get_add_to_cart_hash()
private
get_add_to_cart_hash() : mixed
Return values
mixed —get_submitted_variations()
private
get_submitted_variations(mixed $params, mixed $product) : mixed
Parameters
- $params : mixed
- $product : mixed