Delete if qty = 0

This commit is contained in:
Mike Jolley 2016-08-24 16:09:39 +01:00
parent a8dc46cfdf
commit 26c4b3ce13
1 changed files with 5 additions and 0 deletions

View File

@ -203,6 +203,11 @@ function wc_save_order_items( $order_id, $items ) {
'taxes' => array( 'total' => $line_tax, 'subtotal' => $line_subtotal_tax ),
);
if ( '0' === $set_data['quantity'] ) {
$item->delete();
continue;
}
foreach ( $set_data as $prop => $value ) {
try {
$setter = "set_$prop";