Warning: This method has been deprecated. Calculation and coupon logic is handled in WC_Cart_Totals instead.
WC_Legacy_Cart::get_discounted_price( mixed $values, mixed $price, bool $add_totals = false )
Function to apply discounts to a product and get the discounted price (before tax is applied).
Description Description
Parameters Parameters
- $values
-
(Required) Cart item.
- $price
-
(Required) Price of item.
- $add_totals
-
(Optional) Legacy.
Default value: false
Return Return
(float) price
Source Source
File: includes/legacy/class-wc-legacy-cart.php
public function get_discounted_price( $values, $price, $add_totals = false ) { wc_deprecated_function( 'WC_Cart::get_discounted_price', '3.2', '' ); $cart_item_key = $values['key']; $cart_item = $this->cart_contents[ $cart_item_key ]; return $cart_item['line_total']; }
Changelog Changelog
Version | Description |
---|---|
3.2.0 | Introduced. |