Update reserved stock when a row already exists
This commit is contained in:
parent
3763d3b428
commit
00f1246553
|
@ -160,7 +160,7 @@ final class ReserveStock {
|
|||
INSERT INTO {$wpdb->wc_reserved_stock} ( `order_id`, `product_id`, `stock_quantity`, `timestamp`, `expires` )
|
||||
SELECT %d, %d, %d, NOW(), ( NOW() + INTERVAL %d MINUTE ) FROM DUAL
|
||||
WHERE ( $query_for_stock FOR UPDATE ) - ( $query_for_reserved_stock FOR UPDATE ) >= %d
|
||||
ON DUPLICATE KEY UPDATE `expires` = VALUES( `expires` )
|
||||
ON DUPLICATE KEY UPDATE `expires` = VALUES( `expires` ), `stock_quantity` = VALUES( `stock_quantity` )
|
||||
",
|
||||
$order->get_id(),
|
||||
$product_id,
|
||||
|
|
Loading…
Reference in New Issue