WC_Legacy_Cart::get_discounted_price()
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).
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. |
WC_Legacy_Cart::get_discounted_price() WC Legacy Cart::get discounted price code WC 7.7.0
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']; }