Skip to content

Instantly share code, notes, and snippets.

@SirDarcanos
Last active October 30, 2023 07:48
Show Gist options
  • Save SirDarcanos/8b9deaf4587f83724588a54c27db8a34 to your computer and use it in GitHub Desktop.
Save SirDarcanos/8b9deaf4587f83724588a54c27db8a34 to your computer and use it in GitHub Desktop.
Reordering Cross-Sells and Up-Sells in WooCommerce
<?php
// Up-sells sorting
add_filter( 'woocommerce_upsells_orderby', function() { return 'date'; } );
add_filter( 'woocommerce_upsells_order', function() { return 'desc'; } );
// Cross-sells sorting
add_filter( 'woocommerce_cross_sells_orderby', function() { return 'date'; } );
add_filter( 'woocommerce_cross_sells_order', function() { return 'desc'; } );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment