Set minimum Order amount for specific Products or Categories in WooCommerce
<p>I've searched extensively to see if other folks had this situation and received an answer with no luck.</p>

<p>Essentially, I have two items customers can add to their cart. I want to make it so they cannot checkout with either of those items if their subtotal is not $15 or more.</p>

<p>Having the ability to just drop their IDs into the code would be fine. Or, I can assign them to the same category and set this minimum by category.</p>

<p>So far all I have is the basic PHP that sets a universal minimum. I just need some help figuring out how to limit this to meet my needs.</p>

<p>I'm a designer not a dev, so any help is much appreciated.</p>

<pre><code>    // Set a minimum dollar amount per order
add_action( 'woocommerce_check_cart_items', 'spyr_set_min_total' );
function spyr_set_min_total() {
    // Only run in the Cart or Checkout pages
    if( is_cart() || is_checkout() ) {
        global $woocommerce;

        // Set minimum cart total
        $minimum_cart_total = 10;

        // Total we are going to be using for the Math
        // This is before taxes and shipping charges
        $total = WC()-&gt;cart-&gt;subtotal;

        // Compare values and add an error is Cart's total
        // happens to be less than the minimum required before checking out.
        // Will display a message along the lines of
        // A Minimum of 10 USD is required before checking out. (Cont. below)
        // Current cart total: 6 USD 
        if( $total &lt;= $minimum_cart_total  ) {
            // Display our error message
            wc_add_notice( sprintf( '&lt;strong&gt;A Minimum of %s %s is required before checking out.&lt;/strong&gt;'
                .'&lt;br /&gt;Current cart\'s total: %s %s',
                $minimum_cart_total,
                get_option( 'woocommerce_currency'),
                $total,
                get_option( 'woocommerce_currency') ),
            'error' );
        }
    }
}
</code></pre>