WC_Order_Data_Store_CPT::untrash_order()publicWC 1.0

Attempts to restore the specified order back to its original status (after having been trashed).

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

Хуков нет.

Возвращает

true|false. If the operation was successful.

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

$WC_Order_Data_Store_CPT = new WC_Order_Data_Store_CPT();
$WC_Order_Data_Store_CPT->untrash_order( $order ): bool;
$order(WC_Order) (обязательный)
The order to be untrashed.

Код WC_Order_Data_Store_CPT::untrash_order() WC 9.2.3

public function untrash_order( WC_Order $order ): bool {
	if ( ! wp_untrash_post( $order->get_id() ) ) {
		return false;
	}

	$order->set_status( get_post_field( 'post_status', $order->get_id() ) );
	return (bool) $order->save();
}