Skip to content

Instantly share code, notes, and snippets.

@SiR-DanieL
Last active October 30, 2023 07:48
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 SiR-DanieL/8b9deaf4587f83724588a54c27db8a34 to your computer and use it in GitHub Desktop.
Save SiR-DanieL/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