WordPress at a glance
function is not described

WC_Abstract_Legacy_Order::legacy_set_total() public WC 1.0

Set an order total.

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

No Hooks.

Return

true/false.

Usage

$WC_Abstract_Legacy_Order = new WC_Abstract_Legacy_Order();
$WC_Abstract_Legacy_Order->legacy_set_total( $amount, $total_type );
$amount(float) (required)
-
$total_type(string)
-

Code of WC_Abstract_Legacy_Order::legacy_set_total() WC 5.0.0

<?php
public function legacy_set_total( $amount, $total_type = 'total' ) {
	if ( ! in_array( $total_type, array( 'shipping', 'tax', 'shipping_tax', 'total', 'cart_discount', 'cart_discount_tax' ) ) ) {
		return false;
	}

	switch ( $total_type ) {
		case 'total' :
			$amount = wc_format_decimal( $amount, wc_get_price_decimals() );
			$this->set_total( $amount );
			update_post_meta( $this->get_id(), '_order_total', $amount );
			break;
		case 'cart_discount' :
			$amount = wc_format_decimal( $amount );
			$this->set_discount_total( $amount );
			update_post_meta( $this->get_id(), '_cart_discount', $amount );
			break;
		case 'cart_discount_tax' :
			$amount = wc_format_decimal( $amount );
			$this->set_discount_tax( $amount );
			update_post_meta( $this->get_id(), '_cart_discount_tax', $amount );
			break;
		case 'shipping' :
			$amount = wc_format_decimal( $amount );
			$this->set_shipping_total( $amount );
			update_post_meta( $this->get_id(), '_order_shipping', $amount );
			break;
		case 'shipping_tax' :
			$amount = wc_format_decimal( $amount );
			$this->set_shipping_tax( $amount );
			update_post_meta( $this->get_id(), '_order_shipping_tax', $amount );
			break;
		case 'tax' :
			$amount = wc_format_decimal( $amount );
			$this->set_cart_tax( $amount );
			update_post_meta( $this->get_id(), '_order_tax', $amount );
			break;
	}

	return true;
}