Skip to content

Instantly share code, notes, and snippets.

@dr5hn
Created October 15, 2017 08:43
Show Gist options
  • Save dr5hn/3d82542fa1f9b9bb3fc913d8687edb10 to your computer and use it in GitHub Desktop.
Save dr5hn/3d82542fa1f9b9bb3fc913d8687edb10 to your computer and use it in GitHub Desktop.
How to change Number of Upsell products displayed on Single Product Page in Woocommerce
<?php
//Changing Number of Upsell products display on Single Product page -- By Darshan Gada
add_filter( 'woocommerce_output_related_products_args', 'wc_change_number_related_products' );
function wc_change_number_related_products( $args ) {
$args['posts_per_page'] = 1;
$args['columns'] = 4; //change number of upsells here
return $args;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment