Automattic\WooCommerce\Internal\DataStores\Orders
OrdersTableRefundDataStore::delete()
Delete a refund order from database.
Метод класса: OrdersTableRefundDataStore{}
Хуков нет.
Возвращает
null
. Ничего (null).
Использование
$OrdersTableRefundDataStore = new OrdersTableRefundDataStore(); $OrdersTableRefundDataStore->delete( $refund, $args );
- $refund(\WC_Order) (обязательный) (передается по ссылке — &)
- Refund object to delete.
- $args(массив)
- Array of args to pass to the delete method.
По умолчанию: array()
Код OrdersTableRefundDataStore::delete() OrdersTableRefundDataStore::delete WC 9.3.3
public function delete( &$refund, $args = array() ) { $refund_id = $refund->get_id(); if ( ! $refund_id ) { return; } $refund_cache_key = WC_Cache_Helper::get_cache_prefix( 'orders' ) . 'refunds' . $refund->get_parent_id(); wp_cache_delete( $refund_cache_key, 'orders' ); $this->delete_order_data_from_custom_order_tables( $refund_id ); $refund->set_id( 0 ); $orders_table_is_authoritative = $refund->get_data_store()->get_current_class_name() === self::class; if ( $orders_table_is_authoritative ) { $data_synchronizer = wc_get_container()->get( DataSynchronizer::class ); if ( $data_synchronizer->data_sync_is_enabled() ) { // Delete the associated post, which in turn deletes order items, etc. through {@see WC_Post_Data}. // Once we stop creating posts for orders, we should do the cleanup here instead. wp_delete_post( $refund_id ); } else { $this->handle_order_deletion_with_sync_disabled( $refund_id ); } } }