WC_Order_Refund_Data_Store_CPT::read_order_data()
Read refund data. Can be overridden by child classes to load other props.
Method of the class: WC_Order_Refund_Data_Store_CPT{}
No Hooks.
Return
null
. Nothing (null).
Usage
// protected - for code of main (parent) or child class $result = $this->read_order_data( $refund, $post_object );
- $refund(WC_Order_Refund) (required) (passed by reference — &)
- Refund object.
- $post_object(object) (required)
- Post object.
Changelog
Since 3.0.0 | Introduced. |
WC_Order_Refund_Data_Store_CPT::read_order_data() WC Order Refund Data Store CPT::read order data code WC 9.2.3
protected function read_order_data( &$refund, $post_object ) { parent::read_order_data( $refund, $post_object ); $id = $refund->get_id(); $refund->set_props( array( 'amount' => get_post_meta( $id, '_refund_amount', true ), 'refunded_by' => metadata_exists( 'post', $id, '_refunded_by' ) ? get_post_meta( $id, '_refunded_by', true ) : absint( $post_object->post_author ), 'refunded_payment' => wc_string_to_bool( get_post_meta( $id, '_refunded_payment', true ) ), 'reason' => metadata_exists( 'post', $id, '_refund_reason' ) ? get_post_meta( $id, '_refund_reason', true ) : $post_object->post_excerpt, ) ); }