EditLock::lock()publicWC 1.0

Assigns an order's edit lock to the current user.

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

Хуков нет.


Массив|true|false. FALSE if no user is logged-in, an array in the same format as {@see get_lock()} otherwise.


$EditLock = new EditLock();
$EditLock->lock( $order );
$order(\WC_Order) (обязательный)
The order to apply the lock to.

Код EditLock::lock() WC 8.1.1

public function lock( \WC_Order $order ) {
	$user_id = get_current_user_id();

	if ( ! $user_id ) {
		return false;

	$order->update_meta_data( self::META_KEY_NAME, time() . ':' . $user_id );

	return $order->get_meta( self::META_KEY_NAME, true, 'edit' );