WC_Discounts::set_items()publicWC 3.2.3

Set items directly. Used by WC_Cart_Totals.

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

No Hooks.

Return

null. Nothing.

Usage

$WC_Discounts = new WC_Discounts();
$WC_Discounts->set_items( $items );
$items(array) (required)
Items to set.

Changelog

Since 3.2.3 Introduced.

Code of WC_Discounts::set_items() WC 6.6.1

public function set_items( $items ) {
	$this->items     = $items;
	$this->discounts = array();
	uasort( $this->items, array( $this, 'sort_by_price' ) );
}