$getstate = $eshopoptions['shipping_state']; if ($eshopoptions['show_allstates'] != '1') { $stateList = $wpdb->get_results("SELECT id,code,stateName FROM {$sttable} WHERE list='{$getstate}' ORDER BY stateName", ARRAY_A); } else { $stateList = $wpdb->get_results("SELECT id,code,stateName,list FROM {$sttable} ORDER BY list,stateName", ARRAY_A); } foreach ($stateList as $code => $value) { $eshopstatelist[$value['id']] = $value['code']; } foreach ($_POST as $name => $value) { //have to do a discount code check here - otherwise things just don't work - but fine for free shipping codes if (strstr($name, 'amount_')) { if (isset($_SESSION['eshop_discount' . $blog_id]) && eshop_discount_codes_check()) { $chkcode = valid_eshop_discount_code($_SESSION['eshop_discount' . $blog_id]); if ($chkcode && apply_eshop_discount_code('discount') > 0) { $discount = apply_eshop_discount_code('discount') / 100; $value = number_format(round($value - $value * $discount, 2), 2); $vset = 'yes'; } } if (is_discountable(calculate_total()) != 0 && !isset($vset)) { $discount = is_discountable(calculate_total()) / 100; $value = number_format(round($value - $value * $discount, 2), 2); } } if (sizeof($stateList) > 0 && ($name == 'state' || $name == 'ship_state')) { if ($value != '') { $value = $eshopstatelist[$value]; } } $p->add_field($name, $value);
function is_shipfree($total) { global $blog_id, $eshopoptions; if (isset($_SESSION['eshop_discount' . $blog_id]) && eshop_discount_codes_check()) { $chkcode = valid_eshop_discount_code($_SESSION['eshop_discount' . $blog_id]); if ($chkcode && apply_eshop_discount_code('shipping')) { return true; } } $amt = $eshopoptions['discount_shipping']; if ($amt != '' && $amt <= $total) { return true; } return false; }