public function value($subtotal = 0)
    {
        $totalWeight = $this->Weight();
        if (!$totalWeight) {
            return $this->Amount = 0;
        }
        $amount = 0;

        $table = $this->config()->weight_cost;
        if (!empty($table) && is_array($table)) {
            // ensure table is sorted
            ksort($table, SORT_NUMERIC);
            // set the amount to the highest value. In case the weight is higher than the max value in
            // the table, use the highest shipping cost and not 0!
            $amount = end($table);
            reset($table);
            foreach ($table as $weight => $cost) {
                if ($totalWeight <= $weight) {
                    $amount = $cost;
                    break;
                }
            }
        }
        return $this->Amount = $amount;
    }