Last active
          March 20, 2021 02:38 
        
      - 
      
- 
        Save rynaldos-zz/0d99df3bd2d83cac9fd519b4ac6bd18c to your computer and use it in GitHub Desktop. 
    [WooCommerce 3.0] Change number of upsells on single products
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | 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
  
            
As far as I know that code never worked, might had been because we use the Divi theme by Elegant Themes. Either way, we had to make our own function with this:
And that in my opinion seems like a much more straightforward solution, at least in our case where we can manipulate the columns with our theme. But maybe this might be something that can be built upon.