Update stock when a row already exists (https://github.com/woocommerce/woocommerce-blocks/pull/2747)
This commit is contained in:
parent
b74b85dc03
commit
b40600a8b2
|
@ -165,7 +165,7 @@ final class ReserveStock {
|
||||||
INSERT INTO {$wpdb->wc_reserved_stock} ( `order_id`, `product_id`, `stock_quantity`, `timestamp`, `expires` )
|
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
|
SELECT %d, %d, %d, NOW(), ( NOW() + INTERVAL %d MINUTE ) FROM DUAL
|
||||||
WHERE ( $query_for_stock FOR UPDATE ) - ( $query_for_reserved_stock FOR UPDATE ) >= %d
|
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(),
|
$order->get_id(),
|
||||||
$product_id,
|
$product_id,
|
||||||
|
|
Loading…
Reference in New Issue