Fix product import on existing, empty unit_type and variant_unit

This commit is contained in:
SarvarKhalimov
2022-02-13 18:28:21 +05:00
parent 28a126024f
commit 42a0a973ba

View File

@@ -73,11 +73,13 @@ module ProductImport
'variant_unit_scale', 'primary_taxon_id')
)
new_variant.save
if entry.attributes['on_demand'].present?
new_variant.on_demand = entry.attributes['on_demand']
end
if entry.attributes['on_hand'].present?
new_variant.on_hand = entry.attributes['on_hand']
if entry.attributes['unit_type'].present? || entry.attributes['variant_unit_name'].present?
if entry.attributes['on_demand'].present?
new_variant.on_demand = entry.attributes['on_demand']
end
if entry.attributes['on_hand'].present?
new_variant.on_hand = entry.attributes['on_hand']
end
end
new_variant.product_id = product_id