Automattic\WooCommerce\Blocks\Domain\Services

Hydration::restore_cached_cart_context │ protected │ WC 11.1.0

Restore the cart context, only if a snapshot was taken this cycle.

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

Хуков нет.

Возвращает

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

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

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->restore_cached_cart_context(): void;

Список изменений

С версии 11.1.0 Введена.

Код Hydration::restore_cached_cart_context() WC 11.2.2

protected function restore_cached_cart_context(): void {
	if ( ! is_string( $this->cached_cart_context ) || ! WC()->cart instanceof \WC_Cart ) {
		return;
	}

	WC()->cart->cart_context   = $this->cached_cart_context;
	$this->cached_cart_context = null;
}