WC_Legacy_Cart
in package
Legacy cart class.
Table of Contents
- $cart_session_data : mixed
- Array of defaults. Not used since 3.2.
- $coupon_applied_count : array<string|int, mixed>
- Contains an array of coupon usage counts after they have been applied.
- __get() : mixed
- Magic getters.
- __isset() : mixed
- Map legacy variables.
- __set() : mixed
- Map legacy variables to setters.
- add_discount() : bool
- Renamed for consistency.
- apply_cart_discounts_after_tax() : mixed
- Function to apply cart discounts after tax.
- apply_product_discounts_after_tax() : mixed
- Function to apply product discounts after tax.
- coupons_enabled() : bool
- Coupons enabled function. Filterable.
- get_cart_discount_tax_total() : float
- Get the total of all cart tax discounts (used for discounts on tax inclusive prices).
- get_cart_discount_total() : float
- Get the total of all cart discounts.
- get_cart_for_session() : mixed
- get_cart_from_session() : mixed
- Methods moved to session class in 3.2.0.
- get_cart_url() : string
- Gets the url to the cart page.
- get_checkout_url() : string
- Gets the url to the checkout page.
- get_discounted_price() : float
- Function to apply discounts to a product and get the discounted price (before tax is applied).
- get_discounts_after_tax() : mixed
- Gets the order discount amount - these are applied after tax.
- get_discounts_before_tax() : mixed
- Gets the total (product) discount amount - these are applied before tax.
- get_order_discount_total() : int
- Get the total of all order discounts (after tax discounts).
- init() : mixed
- Init.
- maybe_set_cart_cookies() : mixed
- persistent_cart_destroy() : mixed
- persistent_cart_update() : mixed
- remove_taxes() : mixed
- Remove taxes.
- set_session() : mixed
- ship_to_billing_address_only() : bool
- Sees if we need a shipping address.
Properties
$cart_session_data
Array of defaults. Not used since 3.2.
public
mixed
$cart_session_data
= array('cart_contents_total' => 0, 'total' => 0, 'subtotal' => 0, 'subtotal_ex_tax' => 0, 'tax_total' => 0, 'taxes' => array(), 'shipping_taxes' => array(), 'discount_cart' => 0, 'discount_cart_tax' => 0, 'shipping_total' => 0, 'shipping_tax_total' => 0, 'coupon_discount_amounts' => array(), 'coupon_discount_tax_amounts' => array(), 'fee_total' => 0, 'fees' => array())
Tags
$coupon_applied_count
Contains an array of coupon usage counts after they have been applied.
public
array<string|int, mixed>
$coupon_applied_count
= array()
Tags
Methods
__get()
Magic getters.
public
__get(string $name) : mixed
If you add/remove cases here please update $legacy_keys in __isset accordingly.
Parameters
- $name : string
-
Property name.
Return values
mixed —__isset()
Map legacy variables.
public
__isset(string $name) : mixed
Parameters
- $name : string
-
Property name.
Return values
mixed —__set()
Map legacy variables to setters.
public
__set(string $name, mixed $value) : mixed
Parameters
- $name : string
-
Property name.
- $value : mixed
-
Value to set.
Return values
mixed —add_discount()
Renamed for consistency.
public
add_discount(string $coupon_code) : bool
Parameters
- $coupon_code : string
Return values
bool — True if the coupon is applied, false if it does not exist or cannot be applied.apply_cart_discounts_after_tax()
Function to apply cart discounts after tax.
public
apply_cart_discounts_after_tax( $values, $price) : mixed
Parameters
Tags
Return values
mixed —apply_product_discounts_after_tax()
Function to apply product discounts after tax.
public
apply_product_discounts_after_tax( $values, $price) : mixed
Parameters
Tags
Return values
mixed —coupons_enabled()
Coupons enabled function. Filterable.
public
coupons_enabled() : bool
Tags
Return values
bool —get_cart_discount_tax_total()
Get the total of all cart tax discounts (used for discounts on tax inclusive prices).
public
get_cart_discount_tax_total() : float
Return values
float —get_cart_discount_total()
Get the total of all cart discounts.
public
get_cart_discount_total() : float
Return values
float —get_cart_for_session()
public
get_cart_for_session() : mixed
Return values
mixed —get_cart_from_session()
Methods moved to session class in 3.2.0.
public
get_cart_from_session() : mixed
Return values
mixed —get_cart_url()
Gets the url to the cart page.
public
get_cart_url() : string
Tags
Return values
string — url to pageget_checkout_url()
Gets the url to the checkout page.
public
get_checkout_url() : string
Tags
Return values
string — url to pageget_discounted_price()
Function to apply discounts to a product and get the discounted price (before tax is applied).
public
get_discounted_price(mixed $values, mixed $price[, bool $add_totals = false ]) : float
Parameters
- $values : mixed
-
Cart item.
- $price : mixed
-
Price of item.
- $add_totals : bool = false
-
Legacy.
Tags
Return values
float — priceget_discounts_after_tax()
Gets the order discount amount - these are applied after tax.
public
get_discounts_after_tax() : mixed
Tags
Return values
mixed —get_discounts_before_tax()
Gets the total (product) discount amount - these are applied before tax.
public
get_discounts_before_tax() : mixed
Tags
Return values
mixed — formatted price or false if there are none.get_order_discount_total()
Get the total of all order discounts (after tax discounts).
public
get_order_discount_total() : int
Tags
Return values
int —init()
Init.
public
init() : mixed
Tags
Return values
mixed —maybe_set_cart_cookies()
public
maybe_set_cart_cookies() : mixed
Return values
mixed —persistent_cart_destroy()
public
persistent_cart_destroy() : mixed
Return values
mixed —persistent_cart_update()
public
persistent_cart_update() : mixed
Return values
mixed —remove_taxes()
Remove taxes.
public
remove_taxes() : mixed
Tags
Return values
mixed —set_session()
public
set_session() : mixed
Return values
mixed —ship_to_billing_address_only()
Sees if we need a shipping address.
public
ship_to_billing_address_only() : bool