|
@@ 1568-1578 (lines=11) @@
|
| 1565 |
|
* @param string $item_type type of the item we're checking, if not a line_item |
| 1566 |
|
* @return integer |
| 1567 |
|
*/ |
| 1568 |
|
public function get_qty_refunded_for_item( $item_id, $item_type = 'line_item' ) { |
| 1569 |
|
$qty = 0; |
| 1570 |
|
foreach ( $this->get_refunds() as $refund ) { |
| 1571 |
|
foreach ( $refund->get_items( $item_type ) as $refunded_item ) { |
| 1572 |
|
if ( absint( $refunded_item->get_meta( '_refunded_item_id' ) ) === $item_id ) { |
| 1573 |
|
$qty += $refunded_item->get_quantity(); |
| 1574 |
|
} |
| 1575 |
|
} |
| 1576 |
|
} |
| 1577 |
|
return $qty; |
| 1578 |
|
} |
| 1579 |
|
|
| 1580 |
|
/** |
| 1581 |
|
* Get the refunded amount for a line item. |
|
@@ 1587-1597 (lines=11) @@
|
| 1584 |
|
* @param string $item_type type of the item we're checking, if not a line_item |
| 1585 |
|
* @return integer |
| 1586 |
|
*/ |
| 1587 |
|
public function get_total_refunded_for_item( $item_id, $item_type = 'line_item' ) { |
| 1588 |
|
$total = 0; |
| 1589 |
|
foreach ( $this->get_refunds() as $refund ) { |
| 1590 |
|
foreach ( $refund->get_items( $item_type ) as $refunded_item ) { |
| 1591 |
|
if ( absint( $refunded_item->get_meta( '_refunded_item_id' ) ) === $item_id ) { |
| 1592 |
|
$total += $refunded_item->get_total(); |
| 1593 |
|
} |
| 1594 |
|
} |
| 1595 |
|
} |
| 1596 |
|
return $total * -1; |
| 1597 |
|
} |
| 1598 |
|
|
| 1599 |
|
/** |
| 1600 |
|
* Get the refunded amount for a line item. |
|
@@ 1607-1617 (lines=11) @@
|
| 1604 |
|
* @param string $item_type type of the item we're checking, if not a line_item |
| 1605 |
|
* @return double |
| 1606 |
|
*/ |
| 1607 |
|
public function get_tax_refunded_for_item( $item_id, $tax_id, $item_type = 'line_item' ) { |
| 1608 |
|
$total = 0; |
| 1609 |
|
foreach ( $this->get_refunds() as $refund ) { |
| 1610 |
|
foreach ( $refund->get_items( $item_type ) as $refunded_item ) { |
| 1611 |
|
if ( absint( $refunded_item->get_meta( '_refunded_item_id' ) ) === $item_id ) { |
| 1612 |
|
$total += $refunded_item->get_total_tax(); |
| 1613 |
|
} |
| 1614 |
|
} |
| 1615 |
|
} |
| 1616 |
|
return wc_round_tax_total( $total ) * -1; |
| 1617 |
|
} |
| 1618 |
|
|
| 1619 |
|
/** |
| 1620 |
|
* Get total tax refunded by rate ID. |