type:
snippet
category:
Misc cart and checkout
name:
Reverse Order of Items in Cart
versions:
0.6.0, 0.7.0, 0.7.1, 0.7.2, 1.0
reference:
http://forum.foxycart.com/discussion/5613/change-order-of-table-rows-in-cart
tags:
Advanced, Snippets, cart and checkout, reverse
date:
2012-03-08

If you want to reverse the order of the items in the cart so that recently added items show at the top, you can do this with a little bit of jQuery. Add the following code to your cart, checkout, and receipt templates.

<script type="text/javascript">
 
(function($) {
$.fn.reverseOrder = function() {
	return this.each(function() {
		$(this).prependTo( $(this).parent() );
	});
};
})(jQuery);
 
$(function(){
$('table#fc_cart_table tr.fc_cart_item').reverseOrder();  
});
 
</script>

Site Tools