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

Automattic\WooCommerce\Blocks\StoreApi\Routes

Checkout::create_or_update_draft_order() protected WC 1.0

Create or update a draft order based on the cart.

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

Хуков нет.

Возвращает

\WC_Order. Order object.

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

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->create_or_update_draft_order();

Код Checkout::create_or_update_draft_order() WC 4.7.0

<?php
protected function create_or_update_draft_order() {
	$cart_controller  = new CartController();
	$order_controller = new OrderController();
	$reserve_stock    = \class_exists( '\Automattic\WooCommerce\Checkout\Helpers\ReserveStock' ) ? new \Automattic\WooCommerce\Checkout\Helpers\ReserveStock() : new ReserveStock();
	$order_object     = $this->get_draft_order_object( $this->get_draft_order_id() );
	$created          = false;

	// Validate items etc are allowed in the order before it gets created.
	$cart_controller->validate_cart_items();
	$cart_controller->validate_cart_coupons();

	if ( ! $order_object ) {
		$order_object = $order_controller->create_order_from_cart();
		$created      = true;
	} else {
		$order_controller->update_order_from_cart( $order_object );
	}

	// Store order ID to session.
	$this->set_draft_order_id( $order_object->get_id() );

	// Try to reserve stock for 10 mins, if available.
	try {
		$reserve_stock->reserve_stock_for_order( $order_object, 10 );
	} catch ( ReserveStockException $e ) {
		$error_data = $e->getErrorData();
		throw new RouteException(
			$e->getErrorCode(),
			$e->getMessage(),
			$e->getCode()
		);
	}

	return $order_object;
}