WordPress at Your Fingertips
function is not described

WC_Legacy_Cart::get_discounted_price() public WC 1.0

Deprecated from version 3.2.0 Calculation and coupon logic is handled in WC_Cart_Totals.. It is no longer supported and can be removed in future releases. It is recommended to replace this function with the same one.

Function to apply discounts to a product and get the discounted price (before tax is applied).

{} It's a method of the class: WC_Legacy_Cart{}

No Hooks.

Return

float. price

Usage

$WC_Legacy_Cart = new WC_Legacy_Cart();
$WC_Legacy_Cart->get_discounted_price( $values, $price, $add_totals );
$values(mixed) (required)
Cart item.
$price(mixed) (required)
Price of item.
$add_totals(true|false)
Legacy.
Default: false

Changelog

Deprecated Since 3.2.0 Calculation and coupon logic is handled in WC_Cart_Totals.

Code of WC_Legacy_Cart::get_discounted_price() WC 5.7.1

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'];
}