Skip to content

Commit

Permalink
if overriding tax_category, it only makes sense to update tax_categor…
Browse files Browse the repository at this point in the history
…y_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
  • Loading branch information
mrbrdo committed Nov 22, 2022
1 parent eb3be3d commit cdf9696
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions core/app/models/spree/product.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit cdf9696

Please sign in to comment.