Automattic\WooCommerce\Internal\DataStores\Orders

OrdersTableRefundDataStore::delete()publicWC 1.0

Delete a refund order from database.

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

Хуков нет.

Возвращает

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() WC 7.1.0

public function delete( &$refund, $args = array() ) {
	$refund_id = $refund->get_id();
	if ( ! $refund_id ) {
		return;
	}

	$this->delete_order_data_from_custom_order_tables( $refund_id );
	$refund->set_id( 0 );

	// If this datastore method is called while the posts table is authoritative, refrain from deleting post data.
	if ( ! is_a( $refund->get_data_store(), self::class ) ) {
		return;
	}

	// 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 );
}