Cart
Cart utilities.
Tags
Table of Contents
- add_cart_item_data() : array<string|int, mixed>
- Add product options data to item inside the cart.
- handle_validation() : bool
- Handles validation on add to cart.
Methods
add_cart_item_data()
Add product options data to item inside the cart.
public
static add_cart_item_data(array<string|int, mixed> $cart_item_data, int $product_id, int $variation_id, int $quantity[, array<string|int, mixed>|null $post_data = null ]) : array<string|int, mixed>
Parameters
- $cart_item_data : array<string|int, mixed>
- $product_id : int
- $variation_id : int
- $quantity : int
- $post_data : array<string|int, mixed>|null = null
-
This is used for the WPT integration.
Tags
Return values
array<string|int, mixed> —handle_validation()
Handles validation on add to cart.
public
static handle_validation(bool $passed, int $product_id, int $quantity[, int|null $variation_id = null ][, WC_Product_Variation $variation = null ][, array<string|int, mixed>|null $post_data = null ]) : bool
Parameters
- $passed : bool
- $product_id : int
- $quantity : int
- $variation_id : int|null = null
- $variation : WC_Product_Variation = null
- $post_data : array<string|int, mixed>|null = null
Tags
Return values
bool —$passed