From a2e68e1f3ca4152afc39e19b69ee2535fc09a59f Mon Sep 17 00:00:00 2001 From: Maikel Date: Thu, 6 Mar 2025 08:49:59 +1100 Subject: [PATCH] Explain stock reset further Co-authored-by: David Cook --- app/controllers/admin/dfc_product_imports_controller.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/controllers/admin/dfc_product_imports_controller.rb b/app/controllers/admin/dfc_product_imports_controller.rb index 4b45f4543b..cfd7ba339a 100644 --- a/app/controllers/admin/dfc_product_imports_controller.rb +++ b/app/controllers/admin/dfc_product_imports_controller.rb @@ -82,6 +82,12 @@ module Admin end end + # Reset stock for any variants that were removed from the catalog. + # + # When variants are removed from the remote catalog, there not for sale + # anymore. We prevent them from being sold by reseting stock to zero. + # We don't delete the variant because it may come back at a later time and + # we don't want to lose the connection to previous orders. def reset_absent_variants(catalog) present_ids = catalog.products.map(&:semanticId) absent_variants = @enterprise.supplied_variants