diff --git a/app/models/product_import/entry_validator.rb b/app/models/product_import/entry_validator.rb index 218863c0653..7c748c9d079 100644 --- a/app/models/product_import/entry_validator.rb +++ b/app/models/product_import/entry_validator.rb @@ -28,7 +28,6 @@ def self.non_updatable_fields description: :description, unit_type: :variant_unit_scale, variant_unit_name: :variant_unit_name, - tax_category: :tax_category_id, } end diff --git a/spec/models/product_importer_spec.rb b/spec/models/product_importer_spec.rb index f42d7c85f0b..3c05ffaef02 100644 --- a/spec/models/product_importer_spec.rb +++ b/spec/models/product_importer_spec.rb @@ -413,6 +413,32 @@ expect(filter('invalid', entries)).to eq 0 expect(filter('update_product', entries)).to eq 1 end + + context "updating tax category" do + let(:csv_data) { + CSV.generate do |csv| + csv << ["name", "producer", "category", "on_hand", "price", "units", + "unit_type", "display_name", "shipping_category", "tax_category"] + csv << ["Hypothetical Cake", enterprise2.name, "Cake", "123", "123", + "500", "g", "Preexisting Banana", shipping_category.name, tax_category2.name] + end + } + + it "allows updating tax category" do + importer.validate_entries + + entries = JSON.parse(importer.entries_json) + expect(filter('valid', entries)).to eq 1 + expect(filter('invalid', entries)).to eq 0 + expect(filter('update_product', entries)).to eq 1 + + importer.save_entries + + variant = Spree::Variant.find_by(display_name: "Preexisting Banana") + expect(variant.on_hand).to eq(123) + expect(variant.tax_category).to eq tax_category2 + end + end end describe "updating variant having an nil display name with CSV with empty display name" do