WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru Платформа для конвертации и монетизации трафика
функция не описана

Automattic\WooCommerce\Blocks\Domain\Services

DraftOrders::delete_expired_draft_orders() public WC 1.0

Delete draft orders older than a day in batches of 20.

Ran on a daily cron schedule.

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

Хуков нет.

Возвращает

Null. Ничего.

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

$DraftOrders = new DraftOrders();
$DraftOrders->delete_expired_draft_orders();

Код DraftOrders::delete_expired_draft_orders() WC 4.7.1

<?php
public function delete_expired_draft_orders() {
	$count      = 0;
	$batch_size = 20;
	$this->ensure_draft_status_registered();
	$orders = wc_get_orders(
		[
			'date_modified' => '<=' . strtotime( '-1 DAY' ),
			'limit'         => $batch_size,
			'status'        => self::DB_STATUS,
			'type'          => 'shop_order',
		]
	);

	// do we bail because the query results are unexpected?
	try {
		$this->assert_order_results( $orders, $batch_size );
		if ( $orders ) {
			foreach ( $orders as $order ) {
				$order->delete( true );
				$count ++;
			}
		}
		if ( $batch_size === $count && function_exists( 'as_enqueue_async_action' ) ) {
			as_enqueue_async_action( 'woocommerce_cleanup_draft_orders' );
		}
	} catch ( Exception $error ) {
		wc_caught_exception( $error, __METHOD__ );
	}
}