Skip to content

Instantly share code, notes, and snippets.

@shameemreza
Created March 14, 2024 10:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shameemreza/93461c563f919acc19ac77f7a0e70850 to your computer and use it in GitHub Desktop.
Save shameemreza/93461c563f919acc19ac77f7a0e70850 to your computer and use it in GitHub Desktop.
WooCommerce - Change product order of displayed upsells on product pages
add_filter( 'woocommerce_upsell_display_args', 'change_upsell_order', 20 );
function change_upsell_order( $args ) {
$args['orderby'] = 'date';
$args['order'] = 'DESC'; // set ASC for oldest to newest
return $args;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment