Created
March 14, 2024 10:49
-
-
Save shameemreza/93461c563f919acc19ac77f7a0e70850 to your computer and use it in GitHub Desktop.
WooCommerce - Change product order of displayed upsells on product pages
This file contains 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_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