wc_order_fully_refunded( int $order_id )
When refunding an order, create a refund line item if the partial refunds do not match order total.
Description Description
This is manual; no gateway refund will be performed.
Parameters Parameters
- $order_id
-
(Required) Order ID.
Source Source
File: includes/wc-order-functions.php
function wc_order_fully_refunded( $order_id ) { $order = wc_get_order( $order_id ); $max_refund = wc_format_decimal( $order->get_total() - $order->get_total_refunded() ); if ( ! $max_refund ) { return; } // Create the refund object. wc_create_refund( array( 'amount' => $max_refund, 'reason' => __( 'Order fully refunded.', 'woocommerce' ), 'order_id' => $order_id, 'line_items' => array(), ) ); $order->add_order_note( __( 'Order status set to refunded. To return funds to the customer you will need to issue a refund through your payment gateway.', 'woocommerce' ) ); }
Changelog Changelog
Version | Description |
---|---|
2.4 | Introduced. |