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


Top ↑

Return Return

(float) price


Top ↑

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

Top ↑

Changelog Changelog

Changelog
Version Description
3.2.0 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.