$cart_totals should be checked to see if its an array

Closes #6496