Automattic\WooCommerce\Internal\DataStores\Orders

OrdersTableRefundDataStore::update_order_meta()publicWC 1.0

Helper method that updates post meta based on an refund object. Mostly used for backwards compatibility purposes in this datastore.

{} Это метод класса: OrdersTableRefundDataStore{}

Возвращает

null. Ничего.

Использование

$OrdersTableRefundDataStore = new OrdersTableRefundDataStore();
$OrdersTableRefundDataStore->update_order_meta( $refund );
$refund(\WC_Order) (обязательный) (передается по ссылке — &)
Refund object.

Код OrdersTableRefundDataStore::update_order_meta() WC 7.1.0

public function update_order_meta( &$refund ) {
	parent::update_order_meta( $refund );

	// Update additional props.
	$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' );
		$refund->update_meta_data( $meta_key, $value );
		$updated_props[] = $prop;
	}

	/**
	 * Fires after updating meta for a order refund.
	 *
	 * @since 2.7.0
	 */
	do_action( 'woocommerce_order_refund_object_updated_props', $refund, $updated_props );
}