WordPress at Your Fingertips
function is not described

WC_Order_Refund_Data_Store_CPT::update_post_meta() protected WC 3.0.0

Helper method that updates all the post meta for an order based on it's settings in the WC_Order class.

{} It's a method of the class: WC_Order_Refund_Data_Store_CPT{}

Return

null. Nothing.

Usage

// protected - for code of main (parent) or child class
$result = $this->update_post_meta( $refund );
$refund(WC_Order_Refund) (required) (passed by reference — &)
Refund object.

Changelog

Since 3.0.0 Introduced.

Code of WC_Order_Refund_Data_Store_CPT::update_post_meta() WC 5.7.1

protected function update_post_meta( &$refund ) {
	parent::update_post_meta( $refund );

	$updated_props     = array();
	$meta_key_to_props = array(
		'_refund_amount'    => 'amount',
		'_refunded_by'      => 'refunded_by',
		'_refunded_payment' => 'refunded_payment',
		'_refund_reason'    => 'reason',
	);

	$props_to_update = $this->get_props_to_update( $refund, $meta_key_to_props );
	foreach ( $props_to_update as $meta_key => $prop ) {
		$value = $refund->{"get_$prop"}( 'edit' );
		update_post_meta( $refund->get_id(), $meta_key, $value );
		$updated_props[] = $prop;
	}

	do_action( 'woocommerce_order_refund_object_updated_props', $refund, $updated_props );
}