this will take some custom coding to accomplish. in the code examples i give, I am going to use the cart name eCart1, you will need to modify the cart code to match your cart object name.
it will require a recordset, an update behavior and an eCart loop around them.
first, you need to create a recordset to look up the current quntity, assuming the name of the table is "products", the ID columnn is name "productID", and the name of the stock column is "productStock", the recordset query would look like:
SELECT productStock FROM products WHERE productID = paramCartID
in the variables section create a new variable as:
name: paramCartID
type: integer
default value: -1
runTime value: $eCart1->DisplayInfo("ID")
then you need code to set a variable to hold the stock from the recordset minus the quantity in the cart, we'll use a get variable:
<?php $_GET['productStock'] = ($row_recordSetname['productStock'] - $eCart1->DisplayInfo("Quantity")); ?>
on the bindings panel, click the plus button and select URL Variable, set the name to productStock
Now you will need to add an update record behavior.
for the key column, select the productID column, for the valuer, click the lightning bolt and select the ID column from the cart object.
do not set a redirect.
on the second step of the update record wizard, select the productStock column, click the lightning bolt and select the productStock URL Variable.
you then need to add the cart loop around those pieces so the final code has this structure:
<?php
while (!$eCart1->EOF()) {
?>
<product stock lookup recordset>
<set the productStock URL variable
<update record behavior>
<?php
$eCart1->MoveNext();
}
$eCart1->MoveFirst();
?>