WC_Cart_Totals::__construct( WC_Cart $cart = null )

Sets up the items provided, and calculate totals.


Description Description


Parameters Parameters

$cart

(Optional) Cart object to calculate totals for.

Default value: null


Top ↑

Source Source

File: includes/class-wc-cart-totals.php

	public function __construct( &$cart = null ) {
		if ( ! is_a( $cart, 'WC_Cart' ) ) {
			throw new Exception( 'A valid WC_Cart object is required' );
		}

		$this->cart          = $cart;
		$this->calculate_tax = wc_tax_enabled() && ! $cart->get_customer()->get_is_vat_exempt();
		$this->calculate();
	}

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.