Automattic\WooCommerce\Internal\Fulfillments

FulfillmentsManager::update_fulfillment_statusprivateWC 1.0

Update the fulfillment status for the order.

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

Хуков нет.

Возвращает

null. Ничего (null).

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

// private - только в коде основоного (родительского) класса
$result = $this->update_fulfillment_status( $order, $fulfillments );
$order(WC_Order) (обязательный)
The order object.
$fulfillments(массив)
The fulfillments data store.

This method updates the fulfillment status for the order based on the fulfillments data store.
По умолчанию: array()

Код FulfillmentsManager::update_fulfillment_status() WC 10.3.6

private function update_fulfillment_status( $order, $fulfillments = array() ) {
	$last_status = FulfillmentUtils::calculate_order_fulfillment_status( $order, $fulfillments );
	if ( 'no_fulfillments' === $last_status ) {
		$order->delete_meta_data( '_fulfillment_status' );
	} else {
		// Update the fulfillment status meta data.
		$order->update_meta_data( '_fulfillment_status', $last_status );
	}

	$order->save();
}