woocommerce_upsells_total filter-hookWC 3.0.0

Filter the number of upsell products should on the product page.

Usage

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.

Changelog

Since 3.0.0 Introduced.

Where the hook is called

woocommerce_upsell_display()
woocommerce_upsells_total
woocommerce/includes/wc-template-functions.php 2128
$limit = intval( apply_filters( 'woocommerce_upsells_total', $args['posts_per_page'] ?? $limit ) );

Where the hook is used in WooCommerce

Usage not found.