Automattic\WooCommerce\Internal\Caches

OrdersVersionStringInvalidator::did_customer_change │ private │ WC 1.0

Check if the customer ID changed during the update.

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

Хуков нет.

Возвращает

bool. True if customer changed.

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

// private - только в коде основоного (родительского) класса
$result = $this->did_customer_change( $order_id, $order ): bool;
$order_id(int) (обязательный)
The order ID.
$order(WC_Order) (обязательный)
The order object (after save).

Код OrdersVersionStringInvalidator::did_customer_change() WC 11.2.2

private function did_customer_change( int $order_id, $order ): bool {
	if ( ! isset( $this->pre_save_customer_ids[ $order_id ] ) ) {
		return false;
	}

	$old_customer_id = $this->pre_save_customer_ids[ $order_id ];
	$new_customer_id = $order instanceof \WC_Order ? (int) $order->get_customer_id() : 0;

	return $old_customer_id !== $new_customer_id;
}