The out of the box functionality only allows you to define a minimum order amount for a coupon – not a minimum quantity, and there’s no functionality in the UI to make a coupon auto-apply.
Oh, and I just noticed that you only want it to apply to a specific set of items. You don’t have to display your categories, but you really should define a category for this so you can make the coupon only applicable to a select set of items.
Also, you need to group the items in some way.
Otherwise, you’ll have to define all 300 in some sort of list.
If you want incredibly flexible dynamic pricing without adding any code, the dynamic pricing extension is the way to go, but it’s a bit pricey.
You can code it using a hook like so:
add_action( 'woocommerce_add_to_cart', 'wooqty_action', 30 );
function wooqty_action(){
global $woocommerce;
//checking each item in the cart
foreach ( $woocommerce->cart->get_cart() as $cart_item_key => $values ) {
//you can replace prod_cat with another taxonomy name if you wish
$terms = get_the_terms( $values['product_id'], 'prod_cat' );
$found = false;
//checking if this item is in the taxonomy term we define here
foreach ($terms as $term) {
if($term->name == 'category-slug') $found=true;
}
//if it is...
if($found){
//this is the slug of the coupon code you define in the wc dashboard
$coupon_code = 'randomquantitydiscount'
//checking whether the line item quantity is at least 12
if($values[quantity']>=12){
$woocommerce->cart->add_discount($coupon_code);
}}
}
}