Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.
Ruby b2b-commercee-commerceecommerceecommerce-apiecommerce-frameworkecommerce-platformheadlessheadless-commerceheadless-ecommercemarketplacemulti-tenantmulti-vendormulti-vendor-ecommerceopen-sourcespree-commerce
Add `Spree::Product#main_taxon` (#12215)
Łukasz Adamczykbfccb74c3f5c
diff --git a/core/app/models/spree/product.rb b/core/app/models/spree/product.rbindex 51853f077d..98aee9ada6 100644--- a/core/app/models/spree/product.rb+++ b/core/app/models/spree/product.rb@@ -436,6 +436,10 @@ module Spreeendend+ def main_taxon+ category || taxons.first+ end+def taxons_for_store(store)Rails.cache.fetch("#{cache_key_with_version}/taxons-per-store/#{store.id}") dotaxons.for_store(store)diff --git a/core/app/presenters/spree/csv/order_line_item_presenter.rb b/core/app/presenters/spree/csv/order_line_item_presenter.rbindex 4361339e55..3a73abcf07 100644--- a/core/app/presenters/spree/csv/order_line_item_presenter.rb+++ b/core/app/presenters/spree/csv/order_line_item_presenter.rb@@ -98,11 +98,11 @@ module Spree!line_item.product.digital?,line_item.product.tax_category.present?,line_item.product.try(:vendor_name),- taxon_dict(line_item.product.taxons.first)[0],- taxon_dict(line_item.product.taxons.first)[1],- taxon_dict(line_item.product.taxons.first)[2],- taxon_dict(line_item.product.taxons.first)[3],- taxon_dict(line_item.product.taxons.first)[4],+ taxon_dict(line_item.product.main_taxon)[0],+ taxon_dict(line_item.product.main_taxon)[1],+ taxon_dict(line_item.product.main_taxon)[2],+ taxon_dict(line_item.product.main_taxon)[3],+ taxon_dict(line_item.product.main_taxon)[4],index.zero? ? order.bill_address&.full_name : nil,index.zero? ? order.bill_address&.address1 : nil,index.zero? ? order.bill_address&.address2 : nil,