Woocommerce : [max_qty] not work using backorder
-
I need to allow order when product is out of stock and read the quantity in stock. If i set allow backorder the following code with [max_qty] is always 0 and not works:
if ($product->product_type == ‘variable’) {
foreach ($product->get_available_variations() as $key) {
$attr_string = ”;
foreach ( $key[‘attributes’] as $attr_name => $attr_value) {
$attr_string[] = $attr_value;
}
if ( $key[‘max_qty’] > 0 ) { echo ‘<style> body span.swatch.swatch-label.swatch-‘ . implode(‘, ‘, $attr_string) . ‘ {opacity:1!important; background: #484848!important; color: #fff!important;}</style>’; } else { }
}
}
- The topic ‘Woocommerce : [max_qty] not work using backorder’ is closed to new replies.