Allow items to be sent directly to the discounts class

This commit is contained in:
Mike Jolley 2017-11-02 16:18:17 +00:00
parent 130d719d90
commit 624c1a9516
1 changed files with 12 additions and 0 deletions

View File

@ -52,6 +52,18 @@ class WC_Discounts {
}
}
/**
* Set items directly. Used by WC_Cart_Totals.
*
* @since 3.2.3
* @param array $items Items to set.
*/
public function set_items( $items ) {
$this->items = $items;
$this->discounts = array();
uasort( $this->items, array( $this, 'sort_by_price' ) );
}
/**
* Normalise cart items which will be discounted.
*