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
Remove the settings deprecated in Spree 5, and move the tax address onto the store (#14462)
Damian Legawiecabc6e22cb60e
diff --git a/.changeset/store-tax-address-preference.md b/.changeset/store-tax-address-preference.mdnew file mode 100644index 0000000000..d339037e04--- /dev/null+++ b/.changeset/store-tax-address-preference.md@@ -0,0 +1,6 @@+---+'@spree/admin-sdk': minor+'@spree/dashboard': minor+---++Which address a sale's tax is computed from is now a store setting rather than a global one. `preferred_tax_using_ship_address` can be read and written through the Admin API, and merchants can change it under Settings → Store in the Payments card. The default is unchanged: tax follows the shipping address.diff --git a/docs/v6/developer/customization/configuration.mdx b/docs/v6/developer/customization/configuration.mdxindex ef797cd9c5..bd9425ee71 100644--- a/docs/v6/developer/customization/configuration.mdx+++ b/docs/v6/developer/customization/configuration.mdx@@ -30,7 +30,7 @@ This page lists only settings Spree 6 actually reads. Settings that exist for baSettings that shape how a shop sells — when customers are charged, whether stock is counted, which products appear without a price — are properties of a store, not of the installation, so they live on `Spree::Store` and are edited in the dashboard under **Settings → Store**:-`capture_method`, `track_inventory_levels`, `stock_reservations_enabled`, `stock_reservation_ttl_minutes`, `track_price_history`, `show_products_without_price`, `disable_sku_validation`, `address_requires_phone`, `company_field_enabled`, plus `guest_checkout` and `storefront_access` — those last two are owned by the channel, and the store's value is what a channel falls back to.+`capture_method`, `track_inventory_levels`, `stock_reservations_enabled`, `stock_reservation_ttl_minutes`, `track_price_history`, `show_products_without_price`, `disable_sku_validation`, `address_requires_phone`, `company_field_enabled`, `tax_using_ship_address`, plus `guest_checkout` and `storefront_access` — those last two are owned by the channel, and the store's value is what a channel falls back to.They were global before Spree 6. The global versions still exist for one release but are no longer read, so setting one in the initializer changes nothing — run `bin/rake spree:store_settings:backfill_from_config` during the upgrade to copy your values onto every store.@@ -67,7 +67,6 @@ Before Spree 6 this was two separate booleans, `auto_capture` and `auto_capture_| Setting | Default | What it does ||---|---|---|| `always_include_confirm_step` | `false` | Always shows a confirmation step, even when the payment method doesn't need one. |-| `tax_using_ship_address` | `true` | Calculates tax from the shipping address rather than the billing address. || `credit_to_new_allocation` | `false` | Records refunded store credit as a new entry each time instead of topping the original credit back up. |## Carts and stock reservations@@ -192,7 +191,6 @@ These still exist so upgrades don't break, but Spree 6 either ignores them or re| `expedited_exchanges_days_window` | [Exchanges](/v6/developer/core-concepts/returns-exchanges-claims) || `enable_legacy_default_price` | Compatibility switch for the old default-price behavior; leave off || `use_user_locale` | Locale comes from the `x-spree-locale` header or the `locale` parameter |-| `allow_guest_checkout` | The `guest_checkout` setting on the store or channel || `company` | The `company_field_enabled` setting on the store || `address_requires_phone` | The `address_requires_phone` setting on the store || `default_stock_reservation_ttl_minutes` | The `stock_reservation_ttl_minutes` setting on the store |@@ -203,15 +201,28 @@ These still exist so upgrades don't break, but Spree 6 either ignores them or re| `show_products_without_price` | The `show_products_without_price` setting on the store || `disable_sku_validation` | The `disable_sku_validation` setting on the store || `track_price_history` | The `track_price_history` setting on the store |-| `address_requires_state` | State requirements come from the country |-| `checkout_zone` | [Delivery zones](/v6/developer/core-concepts/fulfillments#delivery-methods-and-zones) |-| `currency` | Store and market currencies |+| `tax_using_ship_address` | The `tax_using_ship_address` setting on the store || `disable_store_presence_validation` | Every store-owned record now requires a store |<Warning>These settings have no effect at all in Spree 6, and are scheduled for removal: `allow_checkout_on_gateway_error` (completion checks whether payments cover the total, so a failed gateway call never completes an order), `products_per_page`, `alternative_shipping_phone`, `show_variant_full_price`, `reserve_stock_on`, `storefront_products_path`, `storefront_taxons_path`, `storefront_pages_path`. Setting them changes nothing.</Warning>+## Settings removed in Spree 6++These were deprecated in Spree 5 and are gone. Assigning one in your initializer now raises `NoMethodError`, so delete the line.++| Setting | What to do instead |+|---|---|+| `send_core_emails` | The `send_consumer_transactional_emails` setting on the store, which turns a shop's customer emails on and off. |+| `currency` | Currency belongs to the store and the market. |+| `address_requires_state` | State requirements come from the address country. |+| `checkout_zone` | Use [delivery zones](/v6/developer/core-concepts/fulfillments#delivery-methods-and-zones). |+| `allow_guest_checkout` | Use the `guest_checkout` setting on the store or channel. |+| `binary_inventory_cache` | A stock change always touches its variant. |+| `logo`, `mailer_logo` | The store's own `logo` and `mailer_logo` images, uploaded in the dashboard. Only the global settings are gone; the images themselves are unchanged. |+| `layout`, `always_put_site_name_in_title`, `title_site_name_separator`, `max_level_in_taxons_menu`, `show_raw_product_description`, `shipping_instructions`, `show_only_complete_orders_by_default` | These configured the removed Rails storefront and admin. A storefront owns its own presentation. |+## Related- [Model preferences](/developer/customization/model-preferences) — per-record settingsdiff --git a/packages/admin-sdk/src/params.ts b/packages/admin-sdk/src/params.tsindex 809a972427..127a6220df 100644--- a/packages/admin-sdk/src/params.ts+++ b/packages/admin-sdk/src/params.ts@@ -32,6 +32,8 @@ export interface StoreUpdateParams {preferred_auto_capture?: boolean/** @deprecated Use `preferred_capture_method`; removed in 6.1. */preferred_auto_capture_on_dispatch?: boolean+ /** Calculates tax from the shipping address. When false, calculates tax from the billing address. */+ preferred_tax_using_ship_address?: boolean/** Counts on-hand quantities. Off means everything is treated as always available. */preferred_track_inventory_levels?: boolean/** Holds stock for shoppers while they check out, so the same item can't be sold twice. */diff --git a/packages/admin-sdk/src/types/generated/Store.ts b/packages/admin-sdk/src/types/generated/Store.tsindex 45a063e2f2..696a0a95e1 100644--- a/packages/admin-sdk/src/types/generated/Store.ts+++ b/packages/admin-sdk/src/types/generated/Store.ts@@ -1,4 +1,4 @@-// Typelizer digest 6a05785fdaad11a39b505568b4a2f79e+// Typelizer digest d6a5f7e0d9f02e97d1533ffe2461437e//// DO NOT MODIFY: This file was automatically generated by Typelizer.import type {SetupTask} from '@/types'@@ -31,6 +31,7 @@ interface Store {preferred_capture_method: string;preferred_track_inventory_levels: boolean;preferred_stock_reservations_enabled: boolean;+ preferred_tax_using_ship_address: boolean;preferred_track_price_history: boolean;preferred_show_products_without_price: boolean;preferred_disable_sku_validation: boolean;diff --git a/packages/dashboard/src/locales/ar.json b/packages/dashboard/src/locales/ar.jsonindex 4557d89eda..e685c3bd67 100644--- a/packages/dashboard/src/locales/ar.json+++ b/packages/dashboard/src/locales/ar.json@@ -1418,6 +1418,10 @@"public": "عام — يمكن للجميع التصفّح ورؤية الأسعار"}},+ "tax_using_ship_address": {+ "help": "احتساب الضريبة من عنوان شحن العميل. أوقف هذا الخيار لاحتساب الضريبة حسب عنوان الفوترة بدلاً من ذلك.",+ "label": "احتساب الضريبة حسب عنوان الشحن"+ },"track_inventory_levels": {"help": "احتساب الكميات المتوفرة. أوقفه لمعاملة كل منتج على أنه متاح دائمًا.","label": "تتبع مستويات المخزون"diff --git a/packages/dashboard/src/locales/de.json b/packages/dashboard/src/locales/de.jsonindex 645911be7c..48f326510e 100644--- a/packages/dashboard/src/locales/de.json+++ b/packages/dashboard/src/locales/de.json@@ -1407,6 +1407,10 @@"public": "Öffentlich – alle können stöbern und Preise sehen"}},+ "tax_using_ship_address": {+ "help": "Die Steuer anhand der Lieferadresse des Kunden berechnen. Deaktivieren Sie diese Option, um stattdessen die Rechnungsadresse zu verwenden.",+ "label": "Steuer nach Lieferadresse"+ },"track_inventory_levels": {"help": "Bestände zählen. Ausschalten, um jedes Produkt als immer verfügbar zu behandeln.","label": "Lagerbestand verfolgen"diff --git a/packages/dashboard/src/locales/en.json b/packages/dashboard/src/locales/en.jsonindex dac22dacaf..773dedd745 100644--- a/packages/dashboard/src/locales/en.json+++ b/packages/dashboard/src/locales/en.json@@ -1407,6 +1407,10 @@"public": "Public — anyone can browse and see prices"}},+ "tax_using_ship_address": {+ "help": "Calculate tax from the customer's shipping address. Turn this off to tax by the billing address instead.",+ "label": "Tax by shipping address"+ },"track_inventory_levels": {"help": "Count on-hand quantities. Turn off to treat every product as always available.","label": "Track stock levels"diff --git a/packages/dashboard/src/locales/fr.json b/packages/dashboard/src/locales/fr.jsonindex 1d9cbdad63..a13bf5fb00 100644--- a/packages/dashboard/src/locales/fr.json+++ b/packages/dashboard/src/locales/fr.json@@ -1407,6 +1407,10 @@"public": "Public — tout le monde peut parcourir et voir les prix"}},+ "tax_using_ship_address": {+ "help": "Calculer la taxe à partir de l'adresse de livraison du client. Désactivez cette option pour utiliser l'adresse de facturation.",+ "label": "Taxe selon l'adresse de livraison"+ },"track_inventory_levels": {"help": "Compter les quantités disponibles. Désactivez pour traiter chaque produit comme toujours disponible.","label": "Suivre les niveaux de stock"diff --git a/packages/dashboard/src/locales/pl.json b/packages/dashboard/src/locales/pl.jsonindex b41d3c3ad9..073df9af04 100644--- a/packages/dashboard/src/locales/pl.json+++ b/packages/dashboard/src/locales/pl.json@@ -1421,6 +1421,10 @@"public": "Publiczny — każdy może przeglądać i widzieć ceny"}},+ "tax_using_ship_address": {+ "help": "Oblicz podatek na podstawie adresu dostawy klienta. Wyłącz tę opcję, aby zamiast tego użyć adresu rozliczeniowego.",+ "label": "Podatek według adresu dostawy"+ },"track_inventory_levels": {"help": "Licz dostępne ilości. Wyłącz, aby traktować każdy produkt jako zawsze dostępny.","label": "Śledź stany magazynowe"diff --git a/packages/dashboard/src/locales/zh-CN.json b/packages/dashboard/src/locales/zh-CN.jsonindex 4e8acae8f5..ff484f3b36 100644--- a/packages/dashboard/src/locales/zh-CN.json+++ b/packages/dashboard/src/locales/zh-CN.json@@ -1404,6 +1404,10 @@"public": "公开 — 任何人都可以浏览并查看价格"}},+ "tax_using_ship_address": {+ "help": "根据客户的配送地址计算税费。关闭此选项则改用账单地址计税。",+ "label": "按配送地址计税"+ },"track_inventory_levels": {"help": "统计现有库存。关闭后,所有商品都视为始终有货。","label": "跟踪库存数量"diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/settings/store.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/settings/store.tsxindex 4d39d33f99..254667753c 100644--- a/packages/dashboard/src/routes/_authenticated/$storeId/settings/store.tsx+++ b/packages/dashboard/src/routes/_authenticated/$storeId/settings/store.tsx@@ -101,6 +101,7 @@ function storeToFormValues(store: Store): StoreSettingsFormValues {preferred_address_requires_phone: store.preferred_address_requires_phone ?? false,preferred_capture_method:(store.preferred_capture_method as (typeof CAPTURE_METHODS)[number]) ?? 'checkout',+ preferred_tax_using_ship_address: store.preferred_tax_using_ship_address ?? true,preferred_track_inventory_levels: store.preferred_track_inventory_levels ?? true,preferred_stock_reservations_enabled: store.preferred_stock_reservations_enabled ?? true,preferred_track_price_history: store.preferred_track_price_history ?? true,@@ -216,6 +217,7 @@ function StoreSettingsForm({ store }: { store: Store }) {preferred_company_field_enabled: values.preferred_company_field_enabled,preferred_address_requires_phone: values.preferred_address_requires_phone,preferred_capture_method: values.preferred_capture_method,+ preferred_tax_using_ship_address: values.preferred_tax_using_ship_address,preferred_track_inventory_levels: values.preferred_track_inventory_levels,preferred_stock_reservations_enabled: values.preferred_stock_reservations_enabled,preferred_track_price_history: values.preferred_track_price_history,@@ -598,19 +600,28 @@ function StoreSettingsForm({ store }: { store: Store }) {<CardTitle>{t('admin.pages.settings.store.tab_payments')}</CardTitle></CardHeader><CardContent>- <Controller- control={form.control}- name="preferred_capture_method"- render={({ field }) => (- <ChoiceCardPicker- label={t('admin.fields.store.capture_method.label')}- help={t('admin.fields.store.capture_method.help')}- options={captureMethodOptions}- value={field.value}- onChange={field.onChange}- />- )}- />+ <FieldGroup>+ <Controller+ control={form.control}+ name="preferred_capture_method"+ render={({ field }) => (+ <ChoiceCardPicker+ label={t('admin.fields.store.capture_method.label')}+ help={t('admin.fields.store.capture_method.help')}+ options={captureMethodOptions}+ value={field.value}+ onChange={field.onChange}+ />+ )}+ />+ <SwitchField+ id="store-tax-using-ship-address"+ label={t('admin.fields.store.tax_using_ship_address.label')}+ help={t('admin.fields.store.tax_using_ship_address.help')}+ name="preferred_tax_using_ship_address"+ control={form.control}+ />+ </FieldGroup></CardContent></Card><Card>diff --git a/packages/dashboard/src/schemas/store.ts b/packages/dashboard/src/schemas/store.tsindex d8a93e406d..3653e7d2de 100644--- a/packages/dashboard/src/schemas/store.ts+++ b/packages/dashboard/src/schemas/store.ts@@ -50,6 +50,7 @@ export const storeSettingsFormSchema = z.object({preferred_company_field_enabled: z.boolean(),preferred_address_requires_phone: z.boolean(),preferred_capture_method: z.enum(CAPTURE_METHODS),+ preferred_tax_using_ship_address: z.boolean(),preferred_track_inventory_levels: z.boolean(),preferred_stock_reservations_enabled: z.boolean(),preferred_track_price_history: z.boolean(),diff --git a/spree/api/app/controllers/spree/api/v3/admin/store_controller.rb b/spree/api/app/controllers/spree/api/v3/admin/store_controller.rbindex 4af8ec4547..9e5d9550a7 100644--- a/spree/api/app/controllers/spree/api/v3/admin/store_controller.rb+++ b/spree/api/app/controllers/spree/api/v3/admin/store_controller.rb@@ -65,6 +65,7 @@ module Spree:preferred_auto_capture_on_dispatch,:preferred_track_inventory_levels,:preferred_stock_reservations_enabled,+ :preferred_tax_using_ship_address,:preferred_track_price_history,:preferred_show_products_without_price,:preferred_disable_sku_validation,diff --git a/spree/api/app/serializers/spree/api/v3/admin/customer_serializer.rb b/spree/api/app/serializers/spree/api/v3/admin/customer_serializer.rbindex 3bcea553a7..4bcfc810ea 100644--- a/spree/api/app/serializers/spree/api/v3/admin/customer_serializer.rb+++ b/spree/api/app/serializers/spree/api/v3/admin/customer_serializer.rb@@ -55,7 +55,7 @@ module Spreeattribute :display_total_spent do |user|amount = user.attributes['total_spent'] || user.orders.complete.sum(:total)- currency = Spree::Current.currency || Spree::Current.store&.default_currency || Spree::Config[:currency]+ currency = Spree::Current.currency || Spree::Current.store&.default_currencySpree::Money.new(amount, currency: currency).to_senddiff --git a/spree/api/app/serializers/spree/api/v3/admin/store_serializer.rb b/spree/api/app/serializers/spree/api/v3/admin/store_serializer.rbindex ad61a99609..71588ae061 100644--- a/spree/api/app/serializers/spree/api/v3/admin/store_serializer.rb+++ b/spree/api/app/serializers/spree/api/v3/admin/store_serializer.rb@@ -31,6 +31,7 @@ module Spreepreferred_capture_method: :string,preferred_track_inventory_levels: :boolean,preferred_stock_reservations_enabled: :boolean,+ preferred_tax_using_ship_address: :boolean,preferred_track_price_history: :boolean,preferred_show_products_without_price: :boolean,preferred_disable_sku_validation: :boolean,@@ -68,6 +69,7 @@ module Spree:preferred_capture_method,:preferred_track_inventory_levels,:preferred_stock_reservations_enabled,+ :preferred_tax_using_ship_address,:preferred_track_price_history,:preferred_show_products_without_price,:preferred_disable_sku_validation,diff --git a/spree/api/lib/spree/api/configuration.rb b/spree/api/lib/spree/api/configuration.rbindex 8fbe46f1a4..1df1362e7a 100644--- a/spree/api/lib/spree/api/configuration.rb+++ b/spree/api/lib/spree/api/configuration.rb@@ -3,12 +3,6 @@ require 'spree/core/preferences/runtime_configuration'module Spreemodule Apiclass Configuration < Spree::Preferences::RuntimeConfiguration- preference :api_v2_serializers_cache_ttl, :integer, default: 3600 # 1 hour in seconds- preference :api_v2_collection_cache_ttl, :integer, default: 3600 # 1 hour in seconds- preference :api_v2_collection_cache_namespace, :string, default: 'api_v2_collection_cache'- preference :api_v2_content_type, :string, default: 'application/vnd.api+json'- preference :api_v2_per_page_limit, :integer, default: 500-preference :jwt_expiration, :integer, default: 3600 # 1 hour in seconds (customer/store JWT default)preference :admin_jwt_expiration, :integer, default: 300 # 5 minutes — admin tokens have higher blast radiuspreference :jwt_secret_key, :string, default: nildiff --git a/spree/core/app/mailers/spree/base_mailer.rb b/spree/core/app/mailers/spree/base_mailer.rbindex 97d126f596..d36027d4d4 100644--- a/spree/core/app/mailers/spree/base_mailer.rb+++ b/spree/core/app/mailers/spree/base_mailer.rb@@ -52,7 +52,6 @@ module Spreedef mail(headers = {}, &block)ensure_default_action_mailer_url_host(headers[:store_url])- return unless Spree::Config[:send_core_emails]if @_store_locale_activesuperdiff --git a/spree/core/app/models/concerns/spree/purchase/taxation.rb b/spree/core/app/models/concerns/spree/purchase/taxation.rbindex ef14f856a8..7228473b74 100644--- a/spree/core/app/models/concerns/spree/purchase/taxation.rb+++ b/spree/core/app/models/concerns/spree/purchase/taxation.rb@@ -2,12 +2,12 @@ module Spreemodule Purchase# Tax location and pre-tax sums shared by Spree::Cart and Spree::Order.module Taxation- # The address tax is computed against, honoring the+ # The address tax is computed against, honoring the store's# tax_using_ship_address preference.## @return [Spree::Address, nil]def tax_address- Spree::Config[:tax_using_ship_address] ? ship_address : bill_address+ Spree::StorePreferences.read(store, :tax_using_ship_address) ? ship_address : bill_addressend# The country whose tax applies. Before the customer enters an addressdiff --git a/spree/core/app/models/spree/stock_item.rb b/spree/core/app/models/spree/stock_item.rbindex 5e38e7914e..1a3432c1ab 100644--- a/spree/core/app/models/spree/stock_item.rb+++ b/spree/core/app/models/spree/stock_item.rb@@ -30,7 +30,7 @@ module Spreedelegate :name, to: :variant, prefix: truedelegate :product, to: :variant- after_save :conditional_variant_touch, if: :saved_changes?+ after_save(if: :saved_changes?) { variant.touch }after_touch { variant.touch }after_destroy { variant.touch }@@ -132,17 +132,5 @@ module Spreenumber -= unit.quantityendend-- def conditional_variant_touch- variant.touch if !Spree::Config.binary_inventory_cache || stock_changed?- end-- def stock_changed?- # the variant_id changes from nil when a new stock location is added- (- saved_change_to_count_on_hand? &&- saved_change_to_count_on_hand.any?(&:zero?)- ) || saved_change_to_variant_id?- endendenddiff --git a/spree/core/app/models/spree/store.rb b/spree/core/app/models/spree/store.rbindex 8c514b6b54..4385cd8dca 100644--- a/spree/core/app/models/spree/store.rb+++ b/spree/core/app/models/spree/store.rb@@ -82,6 +82,10 @@ module Spree# See Spree::CaptureMethod.preference :capture_method, :string, default: Spree::CaptureMethod::DEFAULT_CAPTURE_METHODpreference :stock_reservations_enabled, :boolean, default: true+ # Which address a sale's tax is computed against. Stores selling where tax+ # follows the destination keep this on; billing-address jurisdictions turn+ # it off.+ preference :tax_using_ship_address, :boolean, default: true# Catalog preferencespreference :track_inventory_levels, :boolean, default: truepreference :show_products_without_price, :boolean, default: falsediff --git a/spree/core/lib/spree/core/configuration.rb b/spree/core/lib/spree/core/configuration.rbindex 2f525e5811..a924127c97 100644--- a/spree/core/lib/spree/core/configuration.rb+++ b/spree/core/lib/spree/core/configuration.rb@@ -23,7 +23,6 @@ module Spreemodule Coreclass Configuration < Preferences::RuntimeConfiguration# Alphabetized to more easily lookup particular preferences- preference :address_requires_state, :boolean, default: true, deprecated: 'State requirements now come from the address country - see Spree::Country#states_required'preference :address_requires_phone, :boolean, default: false, deprecated: 'Use the address_requires_phone preference in the Spree::Store model'preference :admin_url, :string, default: nil, deprecated: 'Use dashboard_url (or the SPREE_DASHBOARD_URL environment variable) instead — both name the origin where the dashboard is hosted.'# Origin where the React dashboard is hosted (e.g. `https://dashboard.shop.com`),@@ -35,17 +34,12 @@ module Spreepreference :dashboard_url, :string, default: nil, env: 'SPREE_DASHBOARD_URL'preference :allow_checkout_on_gateway_error, :boolean, default: false, deprecated: 'Nothing reads this in Spree 6 — completion checks whether payments cover the total, so a failed gateway call never completes an order'preference :allow_empty_price_amount, :boolean, default: false- preference :allow_guest_checkout, :boolean, default: true, deprecated: true # this is only used in the rails frontend, and is not implemented in APIpreference :alternative_shipping_phone, :boolean, default: false, deprecated: 'Nothing reads this in Spree 6'preference :always_include_confirm_step, :boolean, default: false # Ensures confirmation step is always in checkout_progress bar, but does not force a confirm step if your payment methods do not support it.- preference :always_put_site_name_in_title, :boolean, deprecated: truepreference :always_use_translations, :boolean, default: falsepreference :auto_capture, :boolean, default: true, deprecated: 'Set it on the store instead' # automatically capture the credit card (as opposed to just authorize and capture later)preference :auto_capture_on_dispatch, :boolean, default: false, deprecated: 'Set it on the store instead' # Captures payment on dispatch rather than at checkout.- preference :binary_inventory_cache, :boolean, default: false, deprecated: true # only invalidate product cache when a stock item changes whether it is in_stock- preference :checkout_zone, :string, default: nil, deprecated: true # replace with the name of a zone if you would like to limit the countriespreference :company, :boolean, default: false, deprecated: 'Use the company_field_enabled preference in the Spree::Store model' # Request company field for billing and shipping addr- preference :currency, :string, default: 'USD', deprecated: truepreference :credit_to_new_allocation, :boolean, default: falsepreference :disable_migration_check, :boolean, default: false # when turned on disables the startup warning about missing engine migrationspreference :disable_sku_validation, :boolean, default: false, deprecated: 'Set it on the store instead' # when turned on disables the built-in SKU uniqueness validation@@ -98,10 +92,6 @@ module Spree# Maximum size of an uploaded product video, in bytes.preference :max_video_upload_size, :integer, default: 524_288_000 # 500 MB- preference :layout, :string, deprecated: 'Please use Spree::Frontend::Config[:layout] instead'- preference :logo, :string, deprecated: true- preference :mailer_logo, :string, deprecated: true- preference :max_level_in_taxons_menu, :integer, deprecated: truepreference :non_expiring_credit_types, :array, default: [], deprecated: 'Nothing reads this in Spree 6 — store credits no longer carry a category, and expiry lives on Spree::GiftCard'preference :products_per_page, :integer, default: 12, deprecated: 'Nothing reads this in Spree 6 — pass per_page to the API instead'preference :restock_inventory, :boolean, default: true, deprecated: 'Restocking is decided per line item by Spree::ReturnLineItem#resellable'@@ -118,18 +108,13 @@ module Spreepreference :guest_cart_expiry_days, :integer, default: 30preference :customer_cart_expiry_days, :integer, default: 90preference :empty_cart_expiry_hours, :integer, default: 48- preference :send_core_emails, :boolean, default: true, deprecated: true # Default mail headers settings- preference :shipping_instructions, :boolean, deprecated: true- preference :show_only_complete_orders_by_default, :boolean, deprecated: truepreference :show_variant_full_price, :boolean, default: false, deprecated: 'Nothing reads this in Spree 6 — a storefront decides how it renders prices'preference :show_products_without_price, :boolean, default: false, deprecated: 'Set it on the store instead'- preference :show_raw_product_description, :boolean, deprecated: true- preference :tax_using_ship_address, :boolean, default: true- preference :title_site_name_separator, :string, deprecated: true+ preference :tax_using_ship_address, :boolean, default: true, deprecated: 'Set it on the store instead'preference :track_inventory_levels, :boolean, default: true, deprecated: 'Set it on the store instead' # Determines whether to track on_hand values for variants / products.preference :track_price_history, :boolean, default: true, deprecated: 'Set it on the store instead' # Records price changes for Omnibus Directive compliance. Disable for non-EU stores.preference :price_history_retention_days, :integer, default: 30 # Days to retain price history records. Used by spree:price_history:prune rake task.- preference :use_user_locale, :boolean, default: true+ preference :use_user_locale, :boolean, default: true, deprecated: true# Sets the path used for products, taxons and pages.preference :storefront_products_path, :string, default: 'products', deprecated: 'Nothing reads this in Spree 6 — storefront routes are owned by the storefront'diff --git a/spree/core/lib/tasks/store_settings.rake b/spree/core/lib/tasks/store_settings.rakeindex 313d6fe24a..0ad2091569 100644--- a/spree/core/lib/tasks/store_settings.rake+++ b/spree/core/lib/tasks/store_settings.rake@@ -11,6 +11,7 @@ namespace :spree dodisable_sku_validation: { default: false },show_products_without_price: { default: false },stock_reservations_enabled: { default: true },+ tax_using_ship_address: { default: true },track_inventory_levels: { default: true },track_price_history: { default: true }}.freezediff --git a/spree/core/spec/models/concerns/spree/purchase/taxation_spec.rb b/spree/core/spec/models/concerns/spree/purchase/taxation_spec.rbindex a09713e196..a468ff1759 100644--- a/spree/core/spec/models/concerns/spree/purchase/taxation_spec.rb+++ b/spree/core/spec/models/concerns/spree/purchase/taxation_spec.rb@@ -6,11 +6,13 @@ RSpec.shared_examples 'a taxation host' dolet(:ship_address) { create(:address) }describe '#tax_address' do- it 'honors the tax_using_ship_address preference' do- Spree::Config.set(tax_using_ship_address: true)+ it 'uses the ship address when the store prefers it' do+ stub_store_preferences(store, tax_using_ship_address: true)expect(record.tax_address).to eq(ship_address)+ end- Spree::Config.set(tax_using_ship_address: false)+ it 'uses the bill address when the store prefers it' do+ stub_store_preferences(store, tax_using_ship_address: false)expect(record.tax_address).to eq(bill_address)endenddiff --git a/spree/core/spec/models/spree/order_spec.rb b/spree/core/spec/models/spree/order_spec.rbindex 06605cfb69..aa2162971a 100644--- a/spree/core/spec/models/spree/order_spec.rb+++ b/spree/core/spec/models/spree/order_spec.rb@@ -457,7 +457,7 @@ describe Spree::Order, type: :model dodescribe '#tax_address' dosubject { order.tax_address }- before { Spree::Config[:tax_using_ship_address] = tax_using_ship_address }+ before { stub_store_preferences(order.store, tax_using_ship_address: tax_using_ship_address) }context 'when tax_using_ship_address is true' dolet(:tax_using_ship_address) { true }diff --git a/spree/core/spec/models/spree/stock_item_spec.rb b/spree/core/spec/models/spree/stock_item_spec.rbindex 8f6e43097d..8fcc14f486 100644--- a/spree/core/spec/models/spree/stock_item_spec.rb+++ b/spree/core/spec/models/spree/stock_item_spec.rb@@ -213,49 +213,27 @@ describe Spree::StockItem, type: :model dosubject.variant.update_column(:updated_at, 1.day.ago)end- context 'binary_inventory_cache is set to false (default)' do- context 'in_stock? changes' do- it 'touches its variant' do- expect do- subject.adjust_count_on_hand(subject.count_on_hand * -1)- end.to change { subject.variant.reload.updated_at }- end- end-- context 'in_stock? does not change' do- it 'touches its variant' do- expect do- subject.adjust_count_on_hand((subject.count_on_hand * -1) + 1)- end.to change { subject.variant.reload.updated_at }- end+ context 'in_stock? changes' do+ it 'touches its variant' do+ expect do+ subject.adjust_count_on_hand(subject.count_on_hand * -1)+ end.to change { subject.variant.reload.updated_at }endend- context 'binary_inventory_cache is set to true' do- before { Spree::Config.binary_inventory_cache = true }-- context 'in_stock? changes' do- it 'touches its variant' do- expect do- subject.adjust_count_on_hand(subject.count_on_hand * -1)- end.to change { subject.variant.reload.updated_at }- end- end-- context 'in_stock? does not change' do- it 'does not touch its variant' do- expect do- subject.adjust_count_on_hand((subject.count_on_hand * -1) + 1)- end.not_to change { subject.variant.reload.updated_at }- end+ context 'in_stock? does not change' do+ it 'touches its variant' do+ expect do+ subject.adjust_count_on_hand((subject.count_on_hand * -1) + 1)+ end.to change { subject.variant.reload.updated_at }end+ end- context 'when a new stock location is added' do- it 'touches its variant' do- expect do- perform_enqueued_jobs { create(:stock_location, propagate_all_variants: true) }- end.to change { subject.variant.reload.updated_at }- end+ context 'when a new stock location is added' do+ it 'touches its variant' do+ expect do+ perform_enqueued_jobs { create(:stock_location, propagate_all_variants: true) }+ end.to change { subject.variant.reload.updated_at }endendenddiff --git a/spree/core/spec/models/spree/variant_spec.rb b/spree/core/spec/models/spree/variant_spec.rbindex 90745066f8..0c145dd759 100644--- a/spree/core/spec/models/spree/variant_spec.rb+++ b/spree/core/spec/models/spree/variant_spec.rb@@ -301,11 +301,9 @@ describe Spree::Variant, type: :model doendcontext 'when currency parameter is nil' do- let!(:price_1) { create(:price, currency: currency, variant: variant, amount: 10) }-- before { Spree::Config[:currency] = currency }-- it { expect(Spree::Variant.for_currency_and_available_price_amount).to include(variant) }+ it 'falls back to the default store currency' do+ expect(Spree::Variant.for_currency_and_available_price_amount).to include(variant)+ endendenddiff --git a/spree/core/spec/services/spree/carts/update_spec.rb b/spree/core/spec/services/spree/carts/update_spec.rbindex effab3aad4..d257d03f22 100644--- a/spree/core/spec/services/spree/carts/update_spec.rb+++ b/spree/core/spec/services/spree/carts/update_spec.rb@@ -374,13 +374,6 @@ module Spreeinclude_examples 'address update', :billing_addresscontext 'with top-level billing_address_id' do- around do |example|- previous = Spree::Config[:tax_using_ship_address]- example.run- ensure- Spree::Config.set(tax_using_ship_address: previous)- end-let(:existing_bill) { create(:address, user: user) }let(:other_bill) { create(:address, user: user) }let(:cart) do@@ -394,7 +387,7 @@ module Spreeendcontext 'when tax is computed from the billing address' do- before { Spree::Config.set(tax_using_ship_address: false) }+ before { stub_store_preferences(store, tax_using_ship_address: false) }it 'recalculates when the tax address is picked by id' doexpect(cart).to receive(:recalculate_for_address_change!)@@ -407,7 +400,7 @@ module Spreeendcontext 'when tax is computed from the shipping address' do- before { Spree::Config.set(tax_using_ship_address: true) }+ before { stub_store_preferences(store, tax_using_ship_address: true) }it 'does not rebuild delivery proposals' docart.rebuild_fulfillments!diff --git a/spree/emails/spec/mailers/spree/order_mailer_spec.rb b/spree/emails/spec/mailers/spree/order_mailer_spec.rbindex 6f89f0738d..8ec48a2576 100644--- a/spree/emails/spec/mailers/spree/order_mailer_spec.rb+++ b/spree/emails/spec/mailers/spree/order_mailer_spec.rb@@ -298,14 +298,6 @@ describe Spree::OrderMailer, type: :mailer doendend- context 'with preference :send_core_emails set to false' do- it 'sends no email' do- Spree::Config.set(:send_core_emails, false)- message = described_class.confirm_email(order)- expect(message.body).to be_blank- end- end-context 'confirm_email comes with data of the store where order was made' doit 'shows order store data' doconfirmation_email = described_class.confirm_email(order)