From cdf96966db0efe6908252a01762497f53f54c36c Mon Sep 17 00:00:00 2001 From: mrbrdo Date: Tue, 22 Nov 2022 19:16:09 +0100 Subject: [PATCH] if overriding tax_category, it only makes sense to update tax_category_id as well fixes confusing display of Tax category as "None" in admin, while it actually uses "Default" ideally, it would be better to update the tax_category_id in the DB and re-update if TaxCategory#is_default changes --- core/app/models/spree/product.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/core/app/models/spree/product.rb b/core/app/models/spree/product.rb index e4983fe0c34..5d995813cf5 100644 --- a/core/app/models/spree/product.rb +++ b/core/app/models/spree/product.rb @@ -220,6 +220,10 @@ def tax_category @tax_category ||= super || TaxCategory.find_by(is_default: true) end + def tax_category_id + super || tax_category.try(:id) + end + # Adding properties and option types on creation based on a chosen prototype attr_accessor :prototype_id