Change number of upsells output in WooCommerce

Add this code to your child theme’s functions.php file or via a plugin that allows custom functions to be added, such as the Dessky Snippets plugin. Please don’t add custom code directly to your parent theme’s functions.php file as this will be overwritten completely when you update the theme.

/**
 * Change number of upsells output
 */
add_filter( 'woocommerce_upsell_display_args', 'wc_change_number_related_products', 20 );

function wc_change_number_related_products( $args ) {
 
 $args['posts_per_page'] = 1;
 $args['columns'] = 4; //change number of upsells here
 return $args;
}
romberger nati-francina@mailxu.com eisenberger-sqc@mailxu.com