WC_Order_Refund_Data_Store_CPT::delete()
Delete a refund - no trash is supported.
Method of the class: WC_Order_Refund_Data_Store_CPT{}
Hooks from the method
Return
null
. Nothing (null).
Usage
$WC_Order_Refund_Data_Store_CPT = new WC_Order_Refund_Data_Store_CPT(); $WC_Order_Refund_Data_Store_CPT->delete( $order, $args );
- $order(WC_Order) (required) (passed by reference — &)
- Order object.
- $args(array)
- Array of args to pass to the delete method.
Default: array()
WC_Order_Refund_Data_Store_CPT::delete() WC Order Refund Data Store CPT::delete code WC 9.2.3
public function delete( &$order, $args = array() ) { $id = $order->get_id(); $parent_order_id = $order->get_parent_id(); $refund_cache_key = WC_Cache_Helper::get_cache_prefix( 'orders' ) . 'refunds' . $parent_order_id; if ( ! $id ) { return; } wp_delete_post( $id ); wp_cache_delete( $refund_cache_key, 'orders' ); $order->set_id( 0 ); do_action( 'woocommerce_delete_order_refund', $id ); }