WC_Stripe_Controller_Cart
extends WC_Stripe_Rest_Controller
in package
uses
WC_Stripe_Controller_Cart_Trait, WC_Stripe_Controller_Frontend_Trait
Controller class that perfors cart operations for client side requests.
Tags
Table of Contents
Properties
- $error : WP_Error
- $namespace : mixed
- $request : WP_REST_Request
Methods
- add_ready_to_calc_shipping() : mixed
- Method that hooks in to the woocommerce_cart_ready_to_calc_shipping filter.
- add_to_cart() : WP_REST_Response
- admin_permission_check() : mixed
- cart_calculation() : mixed
- Performs a cart calculation
- register_routes() : mixed
- Register all routes that the controller uses.
- rest_uri() : mixed
- rest_url() : mixed
- update_shipping_address() : mixed
- update_shipping_method() : mixed
- Update the shipping method chosen by the customer.
- validate_quantity() : mixed
- validate_rest_nonce() : bool|WP_Error
- validate_shipping_address() : mixed
- add_validation_error() : mixed
- Allows a status code of 200 to be returned even if there is a validation error.
- cart_includes() : mixed
- empty_cart() : void
- frontend_includes() : mixed
- get_add_to_cart_args() : array<string|int, mixed>
- Return an array of arguments used to add a product to the cart.
- get_error_messages() : mixed
- get_messages() : mixed
- get_supported_gateways() : mixed
- register_authenticated_route() : mixed
- clear_cached_shipping_rates() : mixed
- filtered_body_params() : mixed
- get_shipping_method_from_request() : array<string|int, mixed>
- has_shipping_methods() : mixed
- Return true if the provided packages have shipping methods.
Properties
$error
protected
WP_Error
$error
= \null
$namespace
protected
mixed
$namespace
= 'cart'
$request
private
WP_REST_Request
$request
Tags
Methods
add_ready_to_calc_shipping()
Method that hooks in to the woocommerce_cart_ready_to_calc_shipping filter.
public
add_ready_to_calc_shipping() : mixed
Purpose is to ensure true is returned so shipping packages are calculated. Some 3rd party plugins and themes return false if the current page is the cart because they don't want to display the shipping calculator.
Tags
add_to_cart()
public
add_to_cart(WP_REST_Request $request) : WP_REST_Response
Parameters
- $request : WP_REST_Request
Return values
WP_REST_Responseadmin_permission_check()
public
admin_permission_check(WP_REST_Request $request) : mixed
Parameters
- $request : WP_REST_Request
cart_calculation()
Performs a cart calculation
public
cart_calculation(WP_REST_Request $request) : mixed
Parameters
- $request : WP_REST_Request
register_routes()
Register all routes that the controller uses.
public
register_routes() : mixed
rest_uri()
public
rest_uri([mixed $uri = '' ]) : mixed
Parameters
- $uri : mixed = ''
rest_url()
public
rest_url([mixed $uri = '' ]) : mixed
Parameters
- $uri : mixed = ''
update_shipping_address()
public
update_shipping_address(WP_REST_Request $request) : mixed
Parameters
- $request : WP_REST_Request
update_shipping_method()
Update the shipping method chosen by the customer.
public
update_shipping_method(WP_REST_Request $request) : mixed
Parameters
- $request : WP_REST_Request
validate_quantity()
public
validate_quantity(int $qty, WP_REST_Request $request) : mixed
Parameters
- $qty : int
- $request : WP_REST_Request
validate_rest_nonce()
public
validate_rest_nonce(mixed $request) : bool|WP_Error
Parameters
- $request : mixed
Tags
Return values
bool|WP_Errorvalidate_shipping_address()
public
validate_shipping_address(array<string|int, mixed> $address, WP_REST_Request $request) : mixed
Parameters
- $address : array<string|int, mixed>
- $request : WP_REST_Request
add_validation_error()
Allows a status code of 200 to be returned even if there is a validation error.
protected
add_validation_error(WP_Error $error) : mixed
Parameters
- $error : WP_Error
cart_includes()
protected
cart_includes() : mixed
empty_cart()
protected
empty_cart(WC_Cart $cart) : void
Parameters
- $cart : WC_Cart
frontend_includes()
protected
frontend_includes() : mixed
get_add_to_cart_args()
Return an array of arguments used to add a product to the cart.
protected
get_add_to_cart_args(WP_REST_Request $request) : array<string|int, mixed>
Parameters
- $request : WP_REST_Request
Tags
Return values
array<string|int, mixed>get_error_messages()
protected
get_error_messages() : mixed
get_messages()
protected
get_messages([mixed $types = 'all' ]) : mixed
Parameters
- $types : mixed = 'all'
Tags
get_supported_gateways()
protected
get_supported_gateways([mixed $context = 'product' ]) : mixed
Parameters
- $context : mixed = 'product'
register_authenticated_route()
protected
register_authenticated_route(string $route) : mixed
Parameters
- $route : string
clear_cached_shipping_rates()
private
clear_cached_shipping_rates(mixed $packages) : mixed
Parameters
- $packages : mixed
filtered_body_params()
private
filtered_body_params(mixed $params, mixed $filter_keys) : mixed
Parameters
- $params : mixed
- $filter_keys : mixed
get_shipping_method_from_request()
private
get_shipping_method_from_request(WP_Rest_Request $request) : array<string|int, mixed>
Parameters
- $request : WP_Rest_Request
Tags
Return values
array<string|int, mixed>has_shipping_methods()
Return true if the provided packages have shipping methods.
private
has_shipping_methods(array<string|int, mixed> $packages) : mixed
Parameters
- $packages : array<string|int, mixed>