| @@ 76-86 (lines=11) @@ | ||
| 73 | * Set items. |
|
| 74 | * @param array $items |
|
| 75 | */ |
|
| 76 | public function set_items( $items ) { |
|
| 77 | $this->items = array(); |
|
| 78 | $items = array_filter( (array) $items ); |
|
| 79 | ||
| 80 | foreach ( $items as $key => $item ) { |
|
| 81 | if ( ! is_a( $item, 'WC_Item_Product' ) ) { |
|
| 82 | $item = new WC_Item_Product( $item ); |
|
| 83 | } |
|
| 84 | $this->items[ $key ] = $item; |
|
| 85 | } |
|
| 86 | } |
|
| 87 | ||
| 88 | /** |
|
| 89 | * Set items. |
|
| @@ 92-102 (lines=11) @@ | ||
| 89 | * Set items. |
|
| 90 | * @param array $items |
|
| 91 | */ |
|
| 92 | public function set_removed_items( $items ) { |
|
| 93 | $this->removed_items = array(); |
|
| 94 | $items = array_filter( (array) $items ); |
|
| 95 | ||
| 96 | foreach ( $items as $key => $item ) { |
|
| 97 | if ( ! is_a( $item, 'WC_Item_Product' ) ) { |
|
| 98 | $item = new WC_Item_Product( $item ); |
|
| 99 | } |
|
| 100 | $this->removed_items[ $key ] = $item; |
|
| 101 | } |
|
| 102 | } |
|
| 103 | ||
| 104 | /** |
|
| 105 | * Remove a cart item. |
|