Reset stock for unavailable products on OC open

This commit is contained in:
Maikel Linke
2025-03-27 14:40:50 +11:00
parent 9e3ff412f9
commit 1a5b6bbc8f
2 changed files with 22 additions and 4 deletions

View File

@@ -57,6 +57,10 @@ class OpenOrderCycleJob < ApplicationJob
catalog = DfcCatalog.load(dfc_user, catalog_url)
catalog.apply_wholesale_values!
variants = Spree::Variant.where(id: catalog_links.pluck(:subject_id))
importer = DfcCatalogImporter.new(variants, catalog)
importer.reset_absent_variants
catalog_links.each do |link|
catalog_item = catalog.item(link.semantic_id)