Automattic\WooCommerce\Internal\DataStores\Orders
OrdersTableRefundDataStore::update_order_meta()
Helper method that updates post meta based on an refund object. Mostly used for backwards compatibility purposes in this datastore.
Метод класса: OrdersTableRefundDataStore{}
Хуки из метода
Возвращает
null
. Ничего (null).
Использование
$OrdersTableRefundDataStore = new OrdersTableRefundDataStore(); $OrdersTableRefundDataStore->update_order_meta( $refund );
- $refund(\WC_Order) (обязательный) (передается по ссылке — &)
- Refund object.
Код OrdersTableRefundDataStore::update_order_meta() OrdersTableRefundDataStore::update order meta WC 9.3.3
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 ) { $meta_object = new WC_Meta_Data(); $meta_object->key = $meta_key; $meta_object->value = $refund->{"get_$prop"}( 'edit' ); $existing_meta = $this->data_store_meta->get_metadata_by_key( $refund, $meta_key ); if ( $existing_meta ) { $existing_meta = $existing_meta[0]; $meta_object->id = $existing_meta->id; $this->update_meta( $refund, $meta_object ); } else { $this->add_meta( $refund, $meta_object ); } $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 ); }