woocommerce_upsells_total
Filter the number of upsell products should on the product page.
Использование
add_filter( 'woocommerce_upsells_total', 'wp_kama_woocommerce_upsells_total_filter' ); /** * Function for `woocommerce_upsells_total` filter-hook. * * @param int $limit number of upsell products. * * @return int */ function wp_kama_woocommerce_upsells_total_filter( $limit ){ // filter... return $limit; }
- $limit(int)
- number of upsell products.
Список изменений
С версии 3.0.0 | Введена. |
Где вызывается хук
woocommerce_upsells_total
woocommerce/includes/wc-template-functions.php 2144
$limit = intval( apply_filters( 'woocommerce_upsells_total', $args['posts_per_page'] ?? $limit ) );