Automattic\WooCommerce\Internal\Fulfillments

FulfillmentsManager::update_fulfillment_statusprivateWC 1.0

Update the fulfillment status for the order.

Method of the class: FulfillmentsManager{}

No Hooks.

Returns

null. Nothing (null).

Usage

// private - for code of main (parent) class only
$result = $this->update_fulfillment_status( $order, $fulfillments );
$order(WC_Order) (required)
The order object.
$fulfillments(array)
The fulfillments data store.

This method updates the fulfillment status for the order based on the fulfillments data store.
Default: array()

FulfillmentsManager::update_fulfillment_status() code WC 10.3.3

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