Minimum Price (Subtotal) To Checkout

This is a repost for version 2.x.



The problem is that the minimum order amount is set to allow checkout for the entire order (subtotal, shipping, tax) instead of just the subtotal. This is what and where the changes need to be made to allow checkout with the minimum of the subtotal. The code can be found at the very end of the file and you just simply need to change “total” to “[COLOR=“Blue”]subtotal[/COLOR]” in the following:



/core/fn.cart.php

// Checks if order can be placed
//
function fn_allow_place_order(&$cart)
{
$[COLOR="Blue"]subtotal[/COLOR] = $cart['[COLOR="Blue"]subtotal[/COLOR]'];

fn_set_hook('allow_place_order', $total, $cart);

$cart['amount_failed'] = (Registry::get('settings.General.min_order_amount') > $[COLOR="Blue"]subtotal[/COLOR] && floatval($[COLOR="Blue"]subtotal[/COLOR]));

if (!empty($cart['amount_failed']) || !empty($cart['shipping_failed'])) {
return false;
}

return true;
}

Thanks Tool Outfitters,

Other posts indicate calculations in the cart is not as it should be, especially for US based companies (ie coupon/discounts deduction should be before tax, not after tax is added-several posts and bug reports on this problem.).

I did note in your code change, the line:

fn_set_hook(‘allow_place_order’, $total, $cart)

I have never tried using hooks, but wondering if the change you made can use this hook. This would not change the original file, but use the hook file. Would this prevent making this change everytime there is an upgrade? How could your “fix” be made using hooks?

I am trying to learn this and this may be a good example.

Thanks,

Bob

Yeah, I read the problem in the bug tracker but this particular problem has been around since the inception of CSC. The only thing it does is takes the minimum of the subtotal (less tax and shipping) instead of total to allow continuing through the checkout process.



I don’t use discounts and coupons but I do agree, from what I read in the bug tracker, that CS has that portion set up wrong as well.