So far this is what I've got:
add_filter('woocommerce_coupon_is_valid','coupon_always_valid',99,2);
function coupon_always_valid($valid, $coupon){
global $woocommerce;
$valid = true;
foreach ( $woocommerce->cart->get_cart() as $cart_item_key => $values ) {
// if($values['data']->backorders_allowed()){ //check if backorders are allowed on this product
// get the stock quantity - returns the available amount number
$stock_info = $values['data']->get_stock_quantity();
if($stock_info < 1){
$vaild = false;
break;
}
}
// give error message...
return $valid ;
}
I don't understand why this option is not built into woocommerce to begin with. We want to blow out what we have in inventory but also take backorders on our products but, we do not want to give a discount to any backorders.
Any help would be appreciated.