WC_Cart::get_cart_item_tax_classes()publicWC 1.0

Get all tax classes for items in the cart.

Method of the class: WC_Cart{}

No Hooks.

Return

Array.

Usage

$WC_Cart = new WC_Cart();
$WC_Cart->get_cart_item_tax_classes();

WC_Cart::get_cart_item_tax_classes() code WC 9.0.1

public function get_cart_item_tax_classes() {
	$found_tax_classes = array();

	foreach ( $this->get_cart() as $item ) {
		if ( $item['data'] && ( $item['data']->is_taxable() || $item['data']->is_shipping_taxable() ) ) {
			$found_tax_classes[] = $item['data']->get_tax_class();
		}
	}

	return array_unique( $found_tax_classes );
}