Automattic\WooCommerce\Blocks\Domain\Services
Hydration::restore_cached_cart_context
Restore the cart context, only if a snapshot was taken this cycle.
Method of the class: Hydration{}
No Hooks.
Returns
null. Nothing (null).
Usage
// protected - for code of main (parent) or child class $result = $this->restore_cached_cart_context(): void;
Changelog
| Since 11.1.0 | Introduced. |
Hydration::restore_cached_cart_context() Hydration::restore cached cart context code 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;
}