Skip to content

Instantly share code, notes, and snippets.

@carlosrudriguez
Created May 24, 2019 03:50
Show Gist options
  • Save carlosrudriguez/81ef7f1a275949371c39bf283a5f734e to your computer and use it in GitHub Desktop.
Save carlosrudriguez/81ef7f1a275949371c39bf283a5f734e to your computer and use it in GitHub Desktop.
Change number of product upsells in WooCommerce
/**
* 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; //change number of upsells here
$args['columns'] = 4; //change number of columns here
return $args;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment