Skip to content

Instantly share code, notes, and snippets.

@wbcomdev
Created June 3, 2021 05:50
Show Gist options
  • Select an option

  • Save wbcomdev/b88f0275edb4652249a5eb7b80d2155a to your computer and use it in GitHub Desktop.

Select an option

Save wbcomdev/b88f0275edb4652249a5eb7b80d2155a to your computer and use it in GitHub Desktop.
<?php
/*
* Change upsells product display.
*
*/
function wbcom_change_upsells_product_display( $args ) {
$args['posts_per_page'] = 4; // 4 display 4 products.
$args['columns'] = 2; // display product in 2 columns.
$args['orderby'] = 'rand';
$args['order'] = 'desc';
return $args;
}
add_filter( 'woocommerce_upsell_display_args', 'wbcom_change_upsells_product_display', 20 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment