diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index 44f01ad..a218716 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -5,6 +5,7 @@ Ubercart 4.x
 * Removed TAPIR, use Form API #table instead.
 * Removed hook_uc_cart_pane(), use the standard cart form and blocks instead.
 * Removed uc_store_get_icon().
+* Removed uc_weight_sort(), use \Drupal\Component\Utility\SortArray::sortByWeightElement() instead.
 * Invoice templates are now named 'uc_order_invoice' to avoid theming conflicts.
 * Order objects now have an interface (UcOrderInterface) and a set of methods:
     * $order->order_id => $order->id()
diff --git a/payment/uc_payment/lib/Drupal/uc_payment/Plugin/PaymentMethodManager.php b/payment/uc_payment/lib/Drupal/uc_payment/Plugin/PaymentMethodManager.php
index 08aad10..ed770d9 100644
--- a/payment/uc_payment/lib/Drupal/uc_payment/Plugin/PaymentMethodManager.php
+++ b/payment/uc_payment/lib/Drupal/uc_payment/Plugin/PaymentMethodManager.php
@@ -43,6 +43,17 @@ class PaymentMethodManager extends DefaultPluginManager {
   }
 
   /**
+   * {@inheritdoc}
+   */
+  public function getDefinitions() {
+    $methods = parent::getDefinitions();
+
+    uasort($methods, 'Drupal\Component\Utility\SortArray::sortByWeightElement');
+
+    return $methods;
+  }
+
+  /**
    * Overrides \Drupal\Component\Plugin\PluginManagerBase::processDefinition().
    */
   public function processDefinition(&$definition, $plugin_id) {
diff --git a/payment/uc_payment/uc_payment.module b/payment/uc_payment/uc_payment.module
index 837c7f1..3ff3e6e 100644
--- a/payment/uc_payment/uc_payment.module
+++ b/payment/uc_payment/uc_payment.module
@@ -452,9 +452,7 @@ function uc_payment_load_payments($order_id) {
  *   An array of payment method definitions, keyed by method ID.
  */
 function uc_payment_method_list() {
-  $methods = Drupal::service('plugin.manager.uc_payment.method')->getDefinitions();
-  uasort($methods, 'uc_weight_sort');
-  return $methods;
+  return \Drupal::service('plugin.manager.uc_payment.method')->getDefinitions();
 }
 
 /**
diff --git a/uc_cart/lib/Drupal/uc_cart/Plugin/CheckoutPaneManager.php b/uc_cart/lib/Drupal/uc_cart/Plugin/CheckoutPaneManager.php
index 22b1367..c0613a9 100644
--- a/uc_cart/lib/Drupal/uc_cart/Plugin/CheckoutPaneManager.php
+++ b/uc_cart/lib/Drupal/uc_cart/Plugin/CheckoutPaneManager.php
@@ -89,7 +89,7 @@ class CheckoutPaneManager extends DefaultPluginManager {
       }
     }
 
-    uasort($panes, 'uc_weight_sort');
+    uasort($panes, 'Drupal\Component\Utility\SortArray::sortByWeightElement');
 
     return $panes;
   }
diff --git a/uc_order/uc_order.line_item.inc b/uc_order/uc_order.line_item.inc
index 37edeaf..2b6fadb 100644
--- a/uc_order/uc_order.line_item.inc
+++ b/uc_order/uc_order.line_item.inc
@@ -157,7 +157,7 @@ function _uc_line_item_list($action = NULL) {
 
   \Drupal::moduleHandler()->alter('uc_line_item_data', $items);
 
-  uasort($items, 'uc_weight_sort');
+  uasort($items, 'Drupal\Component\Utility\SortArray::sortByWeightElement');
 
   return $items;
 }
diff --git a/uc_order/uc_order.module b/uc_order/uc_order.module
index 3853e77..eee556a 100644
--- a/uc_order/uc_order.module
+++ b/uc_order/uc_order.module
@@ -689,7 +689,7 @@ function uc_order_load_line_items($order) {
     }
   }
 
-  usort($items, 'uc_weight_sort');
+  usort($items, 'Drupal\Component\Utility\SortArray::sortByWeightElement');
 
   return $items;
 }
@@ -733,7 +733,7 @@ function uc_order_load_line_items_display($order) {
     $item['formatted_amount'] = uc_currency_format($item['amount']);
   }
 
-  usort($line_items, 'uc_weight_sort');
+  usort($line_items, 'Drupal\Component\Utility\SortArray::sortByWeightElement');
 
   return $line_items;
 }
@@ -962,7 +962,7 @@ function template_preprocess_uc_order_invoice_page(&$variables) {
  */
 function uc_order_state_options_list() {
   $states = \Drupal::moduleHandler()->invokeAll('uc_order_state');
-  uasort($states, 'uc_weight_sort');
+  uasort($states, 'Drupal\Component\Utility\SortArray::sortByWeightElement');
 
   $options = array();
   foreach ($states as $id => $state) {
diff --git a/uc_order/uc_order.order_pane.inc b/uc_order/uc_order.order_pane.inc
index e750322..4b42cde 100644
--- a/uc_order/uc_order.order_pane.inc
+++ b/uc_order/uc_order.order_pane.inc
@@ -688,7 +688,7 @@ function uc_order_pane_line_items($op, $order, &$form = NULL, &$form_state = NUL
           }
         }
       }
-      usort($line_items, 'uc_weight_sort');
+      usort($line_items, 'Drupal\Component\Utility\SortArray::sortByWeightElement');
 
       $build['line_items'] = array(
         '#prefix' => '<table class="line-item-table">',
@@ -740,7 +740,7 @@ function uc_order_pane_line_items($op, $order, &$form = NULL, &$form_state = NUL
           }
         }
       }
-      usort($line_items, 'uc_weight_sort');
+      usort($line_items, 'Drupal\Component\Utility\SortArray::sortByWeightElement');
 
       $form['add_line_item'] = array('#type' => 'container');
 
@@ -1154,7 +1154,7 @@ function _uc_order_pane_list($view = 'view') {
   // Allow other modules to alter the defaults.
   \Drupal::moduleHandler()->alter('uc_order_pane', $panes);
 
-  uasort($panes, 'uc_weight_sort');
+  uasort($panes, 'Drupal\Component\Utility\SortArray::sortByWeightElement');
 
   return $panes;
 }
diff --git a/uc_store/uc_store.module b/uc_store/uc_store.module
index d5bec91..9428669 100644
--- a/uc_store/uc_store.module
+++ b/uc_store/uc_store.module
@@ -1233,17 +1233,6 @@ function _uc_country_import_list() {
 }
 
 /**
- * Sorts an array of arrays having a weight key to determine their order.
- */
-function uc_weight_sort($a, $b) {
-  if ($a['weight'] == $b['weight']) {
-    return 0;
-  }
-
-  return ($a['weight'] > $b['weight']) ? 1 : -1;
-}
-
-/**
  * Returns the default message for a configurable message.
  *
  * @deprecated
diff --git a/uc_taxes/uc_taxes.module b/uc_taxes/uc_taxes.module
index 92882a6..ff6f064 100644
--- a/uc_taxes/uc_taxes.module
+++ b/uc_taxes/uc_taxes.module
@@ -197,7 +197,7 @@ function uc_taxes_uc_order($op, $order, $arg2) {
       // And log the changes to the order.
       if (count($changes)) {
         $order->logChanges($changes);
-        usort($order->line_items, 'uc_weight_sort');
+        usort($order->line_items, 'Drupal\Component\Utility\SortArray::sortByWeightElement');
       }
     break;
   }
