Marketpress :: Code for minimum checkout amount

This replaces the checkout button with a message if the total is below a set amount. It does not take into account shipping or tax or coupons. It is set to a $25 minimum - change the two instances of the number '25' to whatever you need.

As this is a hack to a core file of the plugin, upgrading will require it to be reapplied.

The file is in the marketpress plugins folder
marketpress\marketpress-includes\template-functions.php

About line 471.

Replace this

$content .= '<p class="mp_cart_direct_checkout">';
			$content .= '<a class="mp_cart_direct_checkout_link" href="' . mp_checkout_step_url('shipping') . '">' . __('Checkout Now &raquo;', 'mp') . '</a>';
			$content .= '</p>';

with this

//
// CUSTOM MINIMUM CHECK
//
	$selected_cart = $mp->get_cart_contents(true);

        $totals = array();
        foreach ($selected_cart as $bid => $cart) {
            foreach ($cart as $product_id => $variations) {
                foreach ($variations as $variation => $data) {
                    $totals[] = $data['price'] * $data['quantity'];
                }
            }
        }

        $total = array_sum($totals);
		if ($total < 25){
			 $content .='<p>You need a minimum order amount of $25 to checkout.</p>';
		} else {
			$content .= '<p class="mp_cart_direct_checkout">';
			$content .= '<a class="mp_cart_direct_checkout_link" href="' . mp_checkout_step_url('shipping') . '">' . __('Checkout Now &raquo;', 'mp') . '</a>';
			$content .= '</p>';
		}
//
//