Modifying WooThemes 'Min / Max Qty' plugin to work with the following code?
<p>I'm needing some assistance in getting the following to work: </p>

<p>I'm creating a e-commerce site using the Wordpress plugin Woocommerce and have a number of products with variations which appear in a grid format. As you may know the default Woocommerce way of showing variations is using dropdown menus which isn't pratical for the market of users i'm targeting. Instead, i found a snippet of code from www.eggplantstudios.ca/woocommerce-product-variation-add-cart-grid/ which changes the display of the variations to display in a grid format each with their own 'Add to cart' button. </p>

<p>This works great.</p>

<p>However, my next challenge was to find something which would set  a minimum quantity limit order for the separate variations. I researched and found a plugin offered by WooThemes 'Min / max qty'. I installed and setup the plugin using the documentation, set the limits in the backend and i was ready to go. </p>

<p>Unfortunately, this plugin hasn't worked and is displaying an error message regardless of how many i order. See link <a href="http://www.1085338964.n412591.test.prositehosting.co.uk/product/buxus-sempervirens/" rel="nofollow">here</a></p>

<p>My first step was to contact Woothemes and ask what might be causing the problem. They came back to me with steps to identify the problem and told me to change the theme to the default Wordpress one. Did this and it worked. </p>

<p>So my guess is the code i added from www.eggplantstudios.ca/woocommerce-product-variation-add-cart-grid/ is conflicting with the plugin... :(((</p>

<p>Now with little experience in Php i'm not sure how to progress this to get it working. I really want to keep the grid as it is as i think this such a better way of displaying the variations. </p>

<p>Can anyone point me to where the problem might be caused? Is it a simple fix? </p>

<p>I appreciate any help :) </p>

<p>Thanks</p>

<p>Code from my functions.php file:</p>

<pre><code>function woocommerce_variable_add_to_cart(){
    global $product, $post;

    $variations = find_valid_variations();

    // Check if the special 'price_grid' meta is set, if it is, load the default template:
    if ( get_post_meta($post-&gt;ID, 'price_grid', true) ) {
        // Enqueue variation scripts
        wp_enqueue_script( 'wc-add-to-cart-variation' );

        // Load the template
        wc_get_template( 'single-product/add-to-cart/variable.php', array(
                'available_variations'  =&gt; $product-&gt;get_available_variations(),
                'attributes'            =&gt; $product-&gt;get_variation_attributes(),
                'selected_attributes'   =&gt; $product-&gt;get_variation_default_attributes()
            ) );
        return;
    }

    // Cool, lets do our own template!
    ?&gt;





    &lt;table class="variations variations-grid" cellspacing="0"&gt;
        &lt;thead&gt;
            &lt;tr&gt;
                &lt;th&gt;Container Size&lt;/th&gt;
                &lt;th&gt;Height&lt;/th&gt; 
                &lt;th&gt;Description&lt;/th&gt;
                &lt;th&gt;Quantity&lt;/th&gt;
            &lt;/tr&gt;
        &lt;/thead&gt;
        &lt;tbody&gt;


 &lt;?php
            foreach ($variations as $key =&gt; $value) {
                if( !$value['variation_is_visible'] ) continue;
            ?&gt;   
            &lt;tr&gt;
                    &lt;?php foreach($value['attributes'] as $key =&gt; $val ) {
                        $val = str_replace(array('','_'), ' ', $val);
                        printf( '&lt;td class="attr attr-%s"&gt;%s&lt;/td&gt;  ', $key, ucwords($val) );
                    } 

                    ?&gt;
                   &lt;td class="variation-description"&gt;
                   &lt;?php $desc = $value['variation_description'] ?&gt;

                   &lt;?php if($desc) { ?&gt;

                        &lt;?php echo $desc ?&gt;

                    &lt;?php  }?&gt;

               &lt;/td&gt;
&lt;td&gt; &lt;?php woocommerce_quantity_input(); ?&gt;&lt;/td&gt;
                &lt;td&gt;
                    &lt;?php echo $value['price_html'];?&gt;
                &lt;/td&gt;
                &lt;td&gt;
                    &lt;?php if( $value['is_in_stock'] ) { ?&gt;
                    &lt;form class="cart" action="&lt;?php echo esc_url( $product-&gt;add_to_cart_url() ); ?&gt;" method="post" enctype='multipart/form-data'&gt;

                        &lt;?php
                        if(!empty($value['attributes'])){
                            foreach ($value['attributes'] as $attr_key =&gt; $attr_value) {
                            ?&gt;
                            &lt;input type="hidden" name="&lt;?php echo $attr_key?&gt;" value="&lt;?php echo $attr_value?&gt;"&gt;
                            &lt;?php
                            }
                        }
                        ?&gt;
                        &lt;button type="submit" class="single_add_to_cart_button btn btn-primary"&gt;&lt;span class="glyphicon glyphicon-tag"&gt;&lt;/span&gt; Add to cart&lt;/button&gt;
                        &lt;input type="hidden" name="variation_id" value="&lt;?php echo $value['variation_id']?&gt;" /&gt;
                        &lt;input type="hidden" name="product_id" value="&lt;?php echo esc_attr( $post-&gt;ID ); ?&gt;" /&gt;
                        &lt;input type="hidden" name="add-to-cart" value="&lt;?php echo esc_attr( $post-&gt;ID ); ?&gt;" /&gt;

                    &lt;/form&gt;

                    &lt;?php } else { ?&gt;
                        &lt;p class="stock out-of-stock"&gt;&lt;?php _e( 'This product is currently out of stock and unavailable.', 'woocommerce' ); ?&gt;&lt;/p&gt;
                    &lt;?php } ?&gt;
                &lt;/td&gt;
            &lt;/tr&gt;
            &lt;?php } ?&gt;
        &lt;/tbody&gt;
    &lt;/table&gt;
    &lt;?php
}

function find_valid_variations() {
    global $product;

    $variations = $product-&gt;get_available_variations();
    $attributes = $product-&gt;get_attributes();
    $new_variants = array();

    // Loop through all variations
    foreach( $variations as $variation ) {

        // Peruse the attributes.

        // 1. If both are explicitly set, this is a valid variation
        // 2. If one is not set, that means any, and we must 'create' the rest.

        $valid = true; // so far
        foreach( $attributes as $slug =&gt; $args ) {
            if( array_key_exists("attribute_$slug", $variation['attributes']) &amp;&amp; !empty($variation['attributes']["attribute_$slug"]) ) {
                // Exists

            } else {
                // Not exists, create
                $valid = false; // it contains 'anys'
                // loop through all options for the 'ANY' attribute, and add each
                foreach( explode( '|', $attributes[$slug]['value']) as $attribute ) {
                    $attribute = trim( $attribute );
                    $new_variant = $variation;
                    $new_variant['attributes']["attribute_$slug"] = $attribute;
                    $new_variants[] = $new_variant;
                }

            }
        }

        // This contains ALL set attributes, and is itself a 'valid' variation.
        if( $valid )
            $new_variants[] = $variation;

    }

    return $new_variants;
} 
</code></pre>