Extending the Placement Model
Decrement the number of products from the stock once the order is placed.
We'll cover the following
Now that we have added the quantity
attribute, let’s keep a correct record of the stock by decrementing the products from the stock once the order is placed. We will update the product quantity once the order is saved or once the placement is created. To do this, we will add a method and then hook it up to an after_create
callback.
Get hands-on with 1400+ tech skills courses.