June 07, 2016

Hotel Management System - Travel Port



Adding to cart scenerios

scenerio 1

subtracting add to cart from inventory

if there are 10 items in stock,

5 persons added 2 each to cart then 6 th person could see out of stock issue...

scenerio 2

if not subtracted

1 items left, one person A add it to cart and the second one B purchased it,

A will get out of stock error while purchasing it

One solution

1. The customer puts a product in her cart.
2. Event is fired and the plugin stores the WC_Cart id (which holds the products) with a timestamp in a table.
3. Stock is then temporarily reduced by the plugin.
4. A cronjob (registered via. wp_cron) checks the table with carts and timestamps and resets the stock for old carts and removes the row from the table.


minimum option to skip check
holding time

discussion : https://github.com/woocommerce/woocommerce/issues/5966

is there any procedure after add to cart like adding user details ?



Facebook comments