@@ 1263-1279 (lines=17) @@ | ||
1260 | * @param string $item_type |
|
1261 | * @return string |
|
1262 | */ |
|
1263 | public function get_item_count( $item_type = '' ) { |
|
1264 | if ( empty( $item_type ) ) { |
|
1265 | $item_type = array( 'line_item' ); |
|
1266 | } |
|
1267 | if ( ! is_array( $item_type ) ) { |
|
1268 | $item_type = array( $item_type ); |
|
1269 | } |
|
1270 | ||
1271 | $items = $this->get_items( $item_type ); |
|
1272 | $count = 0; |
|
1273 | ||
1274 | foreach ( $items as $item ) { |
|
1275 | $count += empty( $item['qty'] ) ? 1 : $item['qty']; |
|
1276 | } |
|
1277 | ||
1278 | return apply_filters( 'woocommerce_get_item_count', $count, $item_type, $this ); |
|
1279 | } |
|
1280 | ||
1281 | /** |
|
1282 | * Get refunds |
@@ 143-159 (lines=17) @@ | ||
140 | * @param string $item_type |
|
141 | * @return string |
|
142 | */ |
|
143 | public function get_item_count_refunded( $item_type = '' ) { |
|
144 | if ( empty( $item_type ) ) { |
|
145 | $item_type = array( 'line_item' ); |
|
146 | } |
|
147 | if ( ! is_array( $item_type ) ) { |
|
148 | $item_type = array( $item_type ); |
|
149 | } |
|
150 | $count = 0; |
|
151 | ||
152 | foreach ( $this->get_refunds() as $refund ) { |
|
153 | foreach ( $refund->get_items( $item_type ) as $refunded_item ) { |
|
154 | $count += empty( $refunded_item['qty'] ) ? 0 : $refunded_item['qty']; |
|
155 | } |
|
156 | } |
|
157 | ||
158 | return apply_filters( 'woocommerce_get_item_count_refunded', $count, $item_type, $this ); |
|
159 | } |
|
160 | ||
161 | /** |
|
162 | * Get the total number of items refunded. |