woocommerce_blocks_product_grid_is_cacheable

woocommerce_blocks_product_grid_is_cacheable

Appears in: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
Hook Type: filter

See hook in core

Displaying hooks found in version: woocommerce.9.8.1

apply_filters('woocommerce_blocks_product_grid_is_cacheable') is found 1 times:

  • /src/Blocks/BlockTypes/AbstractProductGrid.php line 355
    351
    352
    353
    354
    355
    356
    357
    358
    359
    360
    361
    * @return array True to enable cache, false to disable cache.
     *
     * @since 2.5.0
     */
    $is_cacheable      = (bool) apply_filters( 'woocommerce_blocks_product_grid_is_cacheable', true, $this->query_args );
    $transient_version = \WC_Cache_Helper::get_transient_version( 'product_query' );
     
    $query   = new BlocksWpQuery( $this->query_args );
    $results = wp_parse_id_list( $is_cacheable ? $query->get_cached_posts( $transient_version ) : $query->get_posts() );
     
    // Remove ordering query arguments which may have been added by get_catalog_ordering_args.