WC_Order::get_item_count_refunded() public WC 2.4.0
Gets the count of order items of a certain type that have been refunded.
{} It's a method of the class: WC_Order{}
Hooks from the method
Return
String.
Usage
$WC_Order = new WC_Order(); $WC_Order->get_item_count_refunded( $item_type );
- $item_type(string)
- Item type.
Changelog
Since 2.4.0 | Introduced. |
Code of WC_Order::get_item_count_refunded() WC Order::get item count refunded WC 5.0.0
public function get_item_count_refunded( $item_type = '' ) {
if ( empty( $item_type ) ) {
$item_type = array( 'line_item' );
}
if ( ! is_array( $item_type ) ) {
$item_type = array( $item_type );
}
$count = 0;
foreach ( $this->get_refunds() as $refund ) {
foreach ( $refund->get_items( $item_type ) as $refunded_item ) {
$count += abs( $refunded_item->get_quantity() );
}
}
return apply_filters( 'woocommerce_get_item_count_refunded', $count, $item_type, $this );
}