|
@@ 1392-1402 (lines=11) @@
|
| 1389 |
|
* @param string $item_type type of the item we're checking, if not a line_item |
| 1390 |
|
* @return integer |
| 1391 |
|
*/ |
| 1392 |
|
public function get_qty_refunded_for_item( $item_id, $item_type = 'line_item' ) { |
| 1393 |
|
$qty = 0; |
| 1394 |
|
foreach ( $this->get_refunds() as $refund ) { |
| 1395 |
|
foreach ( $refund->get_items( $item_type ) as $refunded_item ) { |
| 1396 |
|
if ( absint( $refunded_item->get_meta( '_refunded_item_id' ) ) === $item_id ) { |
| 1397 |
|
$qty += $refunded_item->get_qty(); |
| 1398 |
|
} |
| 1399 |
|
} |
| 1400 |
|
} |
| 1401 |
|
return $qty; |
| 1402 |
|
} |
| 1403 |
|
|
| 1404 |
|
/** |
| 1405 |
|
* Get the refunded amount for a line item. |
|
@@ 1411-1421 (lines=11) @@
|
| 1408 |
|
* @param string $item_type type of the item we're checking, if not a line_item |
| 1409 |
|
* @return integer |
| 1410 |
|
*/ |
| 1411 |
|
public function get_total_refunded_for_item( $item_id, $item_type = 'line_item' ) { |
| 1412 |
|
$total = 0; |
| 1413 |
|
foreach ( $this->get_refunds() as $refund ) { |
| 1414 |
|
foreach ( $refund->get_items( $item_type ) as $refunded_item ) { |
| 1415 |
|
if ( absint( $refunded_item->get_meta( '_refunded_item_id' ) ) === $item_id ) { |
| 1416 |
|
$total += $refunded_item->get_total(); |
| 1417 |
|
} |
| 1418 |
|
} |
| 1419 |
|
} |
| 1420 |
|
return $total * -1; |
| 1421 |
|
} |
| 1422 |
|
|
| 1423 |
|
/** |
| 1424 |
|
* Get the refunded amount for a line item. |
|
@@ 1431-1441 (lines=11) @@
|
| 1428 |
|
* @param string $item_type type of the item we're checking, if not a line_item |
| 1429 |
|
* @return double |
| 1430 |
|
*/ |
| 1431 |
|
public function get_tax_refunded_for_item( $item_id, $tax_id, $item_type = 'line_item' ) { |
| 1432 |
|
$total = 0; |
| 1433 |
|
foreach ( $this->get_refunds() as $refund ) { |
| 1434 |
|
foreach ( $refund->get_items( $item_type ) as $refunded_item ) { |
| 1435 |
|
if ( absint( $refunded_item->get_meta( '_refunded_item_id' ) ) === $item_id ) { |
| 1436 |
|
$total += $refunded_item->get_total_tax(); |
| 1437 |
|
} |
| 1438 |
|
} |
| 1439 |
|
} |
| 1440 |
|
return wc_round_tax_total( $total ) * -1; |
| 1441 |
|
} |
| 1442 |
|
|
| 1443 |
|
/** |
| 1444 |
|
* Get total tax refunded by rate ID. |