Automattic\WooCommerce\Blocks\Utils
BlocksSharedState::get_non_optimistic_properties
Get cart properties that cannot use optimistic UI on the frontend.
Detects whether third-party code has registered callbacks on filters that modify cart property values. When callbacks are present, the corresponding property must use the server-computed value instead of a client-side optimistic computation.
@return string[] List of cart property paths (dot-delimited) that cannot be optimistic.
Метод класса: BlocksSharedState{}
Хуков нет.
Возвращает
Строку[]. List of cart property paths (dot-delimited) that cannot be optimistic.
Использование
$result = BlocksSharedState::get_non_optimistic_properties(): array;
Код BlocksSharedState::get_non_optimistic_properties() BlocksSharedState::get non optimistic properties WC 11.0.1
private static function get_non_optimistic_properties(): array {
$properties = array();
if ( has_filter( 'woocommerce_cart_contents_count' ) ) {
$properties[] = 'cart.items_count';
}
return $properties;
}