WC_Order_Item_Product::set_total()publicWC 1.0

Line total (after discounts).

Method of the class: WC_Order_Item_Product{}

No Hooks.

Return

null. Nothing (null).

Usage

$WC_Order_Item_Product = new WC_Order_Item_Product();
$WC_Order_Item_Product->set_total( $value );
$value(string) (required)
Total.

WC_Order_Item_Product::set_total() code WC 9.3.3

public function set_total( $value ) {
	$value = wc_format_decimal( $value );

	if ( ! is_numeric( $value ) ) {
		$value = 0;
	}

	$this->set_prop( 'total', $value );

	// Subtotal cannot be less than total.
	if ( '' === $this->get_subtotal() || $this->get_subtotal() < $this->get_total() ) {
		$this->set_subtotal( $value );
	}
}