2

I am using Opencart v.2.1.0.2 and I am trying to find the .php file where the "subtract stock" happens after a successful order.

Can anyone please help?

Thank you!

kanenas
  • 841
  • 1
  • 19
  • 35

1 Answers1

1

You can look for it in \catalog\model\checkout\order.php

The update of product quantity

$this->db->query("UPDATE " . DB_PREFIX . "product SET quantity = (quantity - " . (int)$order_product['quantity'] . ") WHERE product_id = '" . (int)$order_product['product_id'] . "' AND subtract = '1'");

The update of product options quantity

$this->db->query("UPDATE " . DB_PREFIX . "product_option_value SET quantity = (quantity - " . (int)$order_product['quantity'] . ") WHERE product_option_value_id = '" . (int)$option['product_option_value_id'] . "' AND subtract = '1'");

Although there are restock querys, if the order is cancelled.

focus.style
  • 5,674
  • 4
  • 18
  • 34