Class: Spree::AppConfiguration

Inherits:
Preferences::Configuration show all
Defined in:
lib/spree/app_configuration.rb

Instance Attribute Summary collapse

Attributes inherited from Preferences::Configuration

#load_defaults_called, #loaded_defaults, #preference_store

Instance Method Summary collapse

Methods inherited from Preferences::Configuration

#check_load_defaults_called, class_name_attribute, #configure, inherited, #initialize, #load_defaults, preference, #reset, #set, #use_legacy_db_preferences!, #use_static_preferences!, versioned_preference

Methods included from Preferences::Preferable

#admin_form_preference_names, #default_preferences, #defined_preferences, #get_preference, #has_preference!, #has_preference?, #preference_default, #preference_type, #set_preference

Constructor Details

This class inherits a constructor from Spree::Preferences::Configuration

Instance Attribute Details

#add_payment_sources_to_wallet_classClass

Allows providing your own class for adding payment sources to a user’s “wallet” after an order moves to the complete state.

Returns:

  • (Class)

    a class with the same public interfaces as Spree::Wallet::AddPaymentSourcesToWallet.



465
# File 'lib/spree/app_configuration.rb', line 465

class_name_attribute :add_payment_sources_to_wallet_class, default: 'Spree::Wallet::AddPaymentSourcesToWallet'

#address_requires_phoneBoolean

Returns should phone number be required (default: true).

Returns:

  • (Boolean)

    should phone number be required (default: true)



33
# File 'lib/spree/app_configuration.rb', line 33

preference :address_requires_phone, :boolean, default: true

#address_requires_stateBoolean

Returns should state/state_name be required (default: true).

Returns:

  • (Boolean)

    should state/state_name be required (default: true)



37
# File 'lib/spree/app_configuration.rb', line 37

preference :address_requires_state, :boolean, default: true

#admin_interface_logoString

Returns URL of logo used in admin (default: ‘logo/solidus.svg’).

Returns:

  • (String)

    URL of logo used in admin (default: ‘logo/solidus.svg’)



41
# File 'lib/spree/app_configuration.rb', line 41

preference :admin_interface_logo, :string, default: 'logo/solidus.svg'

#admin_products_per_pageInteger

Returns Number of products to display in admin (default: 10).

Returns:

  • (Integer)

    Number of products to display in admin (default: 10)



45
# File 'lib/spree/app_configuration.rb', line 45

preference :admin_products_per_page, :integer, default: 10

#admin_variants_per_pageInteger

Returns Number of variants to display in admin (default: 20).

Returns:

  • (Integer)

    Number of variants to display in admin (default: 20)



49
# File 'lib/spree/app_configuration.rb', line 49

preference :admin_variants_per_page, :integer, default: 20

#admin_vat_country_isoString?

Set this if you want to enter prices in the backend including value added tax.

Returns:

  • (String, nil)

    Two-letter ISO code of that Country for which prices are entered in the backend (default: nil)



55
# File 'lib/spree/app_configuration.rb', line 55

preference :admin_vat_country_iso, :string, default: nil

#allow_checkout_on_gateway_errorBoolean

Returns Allow checkout to complete after a failed payment (default: false).

Returns:

  • (Boolean)

    Allow checkout to complete after a failed payment (default: false)



59
# File 'lib/spree/app_configuration.rb', line 59

preference :allow_checkout_on_gateway_error, :boolean, default: false

#allow_guest_checkoutBoolean

Returns When false, customers must create an account to complete an order (default: true).

Returns:

  • (Boolean)

    When false, customers must create an account to complete an order (default: true)



63
# File 'lib/spree/app_configuration.rb', line 63

preference :allow_guest_checkout, :boolean, default: true

#allow_return_item_amount_editingBoolean

Returns Determines whether an admin is allowed to change a return item’s pre-calculated amount (default: false).

Returns:

  • (Boolean)

    Determines whether an admin is allowed to change a return item’s pre-calculated amount (default: false)



71
# File 'lib/spree/app_configuration.rb', line 71

preference :allow_return_item_amount_editing, :boolean, default: false

#allowed_image_mime_typesArray

Defines which MIME types are allowed for images ‘%w(image/jpeg image/jpg image/png image/gif).freeze` is the default.

Returns:

  • (Array)


527
# File 'lib/spree/app_configuration.rb', line 527

class_name_attribute :allowed_image_mime_types, default: %w(image/jpeg image/jpg image/png image/gif).freeze

#alternative_billing_phoneBoolean

Returns Request an extra phone number for bill address (default: false).

Returns:

  • (Boolean)

    Request an extra phone number for bill address (default: false)



75
# File 'lib/spree/app_configuration.rb', line 75

preference :alternative_billing_phone, :boolean, default: false

#alternative_shipping_phoneBoolean

Returns Request an extra phone number for shipping address (default: false).

Returns:

  • (Boolean)

    Request an extra phone number for shipping address (default: false)



79
# File 'lib/spree/app_configuration.rb', line 79

preference :alternative_shipping_phone, :boolean, default: false

#always_put_site_name_in_titleBoolean

Returns When true, site name is always appended to titles on the frontend (default: true).

Returns:

  • (Boolean)

    When true, site name is always appended to titles on the frontend (default: true)



83
# File 'lib/spree/app_configuration.rb', line 83

preference :always_put_site_name_in_title, :boolean, default: true

#auto_captureBoolean

Note:

Setting this to true is not recommended. Performing an authorize and later capture has far superior error handing. VISA and MasterCard also require that shipments are sent within a certain time of the card being charged.

Returns Automatically capture the credit card (as opposed to just authorize and capture later) (default: false).

Returns:

  • (Boolean)

    Automatically capture the credit card (as opposed to just authorize and capture later) (default: false)



91
# File 'lib/spree/app_configuration.rb', line 91

preference :auto_capture, :boolean, default: false

#auto_capture_exchangesBoolean

Returns Automatically capture the credit card (as opposed to just authorize and capture later) (default: false).

Returns:

  • (Boolean)

    Automatically capture the credit card (as opposed to just authorize and capture later) (default: false)



95
# File 'lib/spree/app_configuration.rb', line 95

preference :auto_capture_exchanges, :boolean, default: false

#automatic_default_addressBoolean

The default value of true preserves existing backwards compatible feature of treating the most recently used address in checkout as the user’s default address. Setting to false means that the user should manage their own default via some custom UI that uses AddressBookController.

Returns:

  • (Boolean)

    Whether use of an address in checkout marks it as user’s default



103
# File 'lib/spree/app_configuration.rb', line 103

preference :automatic_default_address, :boolean, default: true

#available_currenciesArray

Returns An array of available currencies from Money::Currency.all.

Returns:

  • (Array)

    An array of available currencies from Money::Currency.all



290
# File 'lib/spree/app_configuration.rb', line 290

attr_writer :available_currencies

#billing_address_requiredBoolean

Controls whether billing address is required or not in the checkout process by default, can be overridden at order level. (default: false)

Returns:

  • (Boolean)


110
# File 'lib/spree/app_configuration.rb', line 110

preference :billing_address_required, :boolean, default: false

#can_restrict_stock_managementBoolean

Returns Indicates if stock management can be restricted by location.

Returns:

  • (Boolean)

    Indicates if stock management can be restricted by location



114
# File 'lib/spree/app_configuration.rb', line 114

preference :can_restrict_stock_management, :boolean, default: false

#carton_shipped_email_classActionMailer::Base

Allows providing your own Mailer for shipped cartons.

Returns:

  • (ActionMailer::Base)

    an object that responds to “shipped_email” (e.g. an ActionMailer with a “shipped_email” method) with the same signature as Spree::CartonMailer.shipped_email.



409
# File 'lib/spree/app_configuration.rb', line 409

class_name_attribute :carton_shipped_email_class, default: 'Spree::CartonMailer'

#checkout_zoneString

Returns Name of a Zone, which limits available countries to those included in that zone. (default: nil).

Returns:

  • (String)

    Name of a Zone, which limits available countries to those included in that zone. (default: nil)



118
# File 'lib/spree/app_configuration.rb', line 118

preference :checkout_zone, :string, default: nil

#companyBoolean

Returns Request company field for billing and shipping addresses. (default: false).

Returns:

  • (Boolean)

    Request company field for billing and shipping addresses. (default: false)



122
# File 'lib/spree/app_configuration.rb', line 122

preference :company, :boolean, default: false

#completable_order_created_cutoffInteger

Returns the number of days to look back for updated orders which get returned to the user as last completed.

Returns:

  • (Integer)

    the number of days to look back for updated orders which get returned to the user as last completed



126
# File 'lib/spree/app_configuration.rb', line 126

preference :completable_order_created_cutoff_days, :integer, default: nil

#countries_that_use_nested_subregionsArray

of the default subregions that come with Carmen. Will be used on store creation to ensure the correct states are generated, and when running the states regenerate rake task. (default: [‘IT’])

Returns:

  • (Array)

    An array of countries that use nested subregions, instead



247
# File 'lib/spree/app_configuration.rb', line 247

preference :countries_that_use_nested_subregions, :array, default: ['IT']

#coupon_code_handler_classClass

Allows providing a different coupon code handler.

Returns:

  • (Class)

    an object that conforms to the API of the standard coupon code handler class Spree::PromotionHandler::Coupon.

See Also:



376
# File 'lib/spree/app_configuration.rb', line 376

class_name_attribute :coupon_code_handler_class, default: 'Spree::PromotionHandler::Coupon'

#credit_to_new_allocationBoolean

Returns Creates a new allocation anytime StoreCredit#credit is called.

Returns:



134
# File 'lib/spree/app_configuration.rb', line 134

preference :credit_to_new_allocation, :boolean, default: false

#currencyString

Currency to use by default when not defined on the site (default: “USD”)

Returns:

  • (String)

    ISO 4217 Three letter currency code



139
# File 'lib/spree/app_configuration.rb', line 139

preference :currency, :string, default: "USD"

#current_store_selector_classClass

Allows providing your own class for choosing which store to use.

Returns:

  • (Class)

    a class with the same public interfaces as Spree::CurrentStoreSelector



488
# File 'lib/spree/app_configuration.rb', line 488

class_name_attribute :current_store_selector_class, default: 'Spree::StoreSelector::ByServerName'

#customer_returns_per_pageInteger

Returns Customer returns to show per-page in the admin (default: 15).

Returns:

  • (Integer)

    Customer returns to show per-page in the admin (default: 15)



143
# File 'lib/spree/app_configuration.rb', line 143

preference :customer_returns_per_page, :integer, default: 15

#default_country_isoString

Default customer country ISO code

Returns:

  • (String)

    Two-letter ISO code of a Country to assumed as the country of an unidentified customer (default: “US”)



148
# File 'lib/spree/app_configuration.rb', line 148

preference :default_country_iso, :string, default: 'US'

#default_email_regexpRegexp

Returns Regex to be used in email validations, for example in Spree::EmailValidator.

Returns:

  • (Regexp)

    Regex to be used in email validations, for example in Spree::EmailValidator



152
# File 'lib/spree/app_configuration.rb', line 152

preference :default_email_regexp, :regexp, default: URI::MailTo::EMAIL_REGEXP

#default_payment_builder_classClass

Allows providing your own class for adding default payments to a user’s order from their “wallet”.

Returns:

  • (Class)

    a class with the same public interfaces as Spree::Wallet::DefaultPaymentBuilder.



424
# File 'lib/spree/app_configuration.rb', line 424

class_name_attribute :default_payment_builder_class, default: 'Spree::Wallet::DefaultPaymentBuilder'

#generate_api_key_for_all_rolesBoolean

at role_user creation for all roles. (default: false)

Returns:

  • (Boolean)

    Allow generating api key automatically for user



157
# File 'lib/spree/app_configuration.rb', line 157

preference :generate_api_key_for_all_roles, :boolean, default: false

Returns Add additional guest_token cookie options here (ie. domain or path).

Returns:

  • (Hash)

    Add additional guest_token cookie options here (ie. domain or path)



67
# File 'lib/spree/app_configuration.rb', line 67

preference :guest_token_cookie_options, :hash, default: {}

#image_attachment_moduleModule

Allows switching attachment library for Image

‘Spree::Image::ActiveStorageAttachment` is the default and provides the Active Storage implementation.

Enumerable of images adhering to the present_image_class interface

Returns:

  • (Module)

    a module that can be included into Spree::Image to allow attachments



519
# File 'lib/spree/app_configuration.rb', line 519

class_name_attribute :image_attachment_module, default: "Spree::Image::ActiveStorageAttachment"

#inventory_cache_thresholdInteger

Only invalidate product caches when the count on hand for a stock item falls below or rises about the inventory_cache_threshold. When undefined, the product caches will be invalidated anytime the count on hand is changed.

Returns:

  • (Integer)


164
# File 'lib/spree/app_configuration.rb', line 164

preference :inventory_cache_threshold, :integer

#layoutString

Returns template to use for layout on the frontend (default: “spree/layouts/spree_application”).

Returns:

  • (String)

    template to use for layout on the frontend (default: “spree/layouts/spree_application”)



168
# File 'lib/spree/app_configuration.rb', line 168

preference :layout, :string, default: 'spree/layouts/spree_application'

#log_entry_allow_aliasesBoolean

Returns Whether YAML aliases are allowed when loading serialized data in LogEntry. It defaults to true. Depending on the source of your data, you may consider disabling it to prevent entity expansion attacks.

Returns:

  • (Boolean)

    Whether YAML aliases are allowed when loading serialized data in LogEntry. It defaults to true. Depending on the source of your data, you may consider disabling it to prevent entity expansion attacks.



188
# File 'lib/spree/app_configuration.rb', line 188

preference :log_entry_allow_aliases, :boolean, default: true

#log_entry_permitted_classesArray<String>

Returns An array of extra classes that are allowed to be loaded from a serialized YAML as details in LogEntry (defaults to a non-frozen empty array, so that extensions can add their own classes).

Examples:

config.log_entry_permitted_classes = ['Date']

Returns:

  • (Array<String>)

    An array of extra classes that are allowed to be loaded from a serialized YAML as details in LogEntry (defaults to a non-frozen empty array, so that extensions can add their own classes).



181
# File 'lib/spree/app_configuration.rb', line 181

preference :log_entry_permitted_classes, :array, default: []

#logoString

Returns URL of logo used on frontend (default: ‘logo/solidus.svg’).

Returns:

  • (String)

    URL of logo used on frontend (default: ‘logo/solidus.svg’)



172
# File 'lib/spree/app_configuration.rb', line 172

preference :logo, :string, default: 'logo/solidus.svg'

#max_level_in_taxons_menuInteger

Returns maximum nesting level in taxons menu (default: 1).

Returns:

  • (Integer)

    maximum nesting level in taxons menu (default: 1)



192
# File 'lib/spree/app_configuration.rb', line 192

preference :max_level_in_taxons_menu, :integer, default: 1

#migration_pathPathname

Configures the absolute path that contains the Solidus engine migrations. This will be checked at app boot to confirm that all Solidus migrations are installed.

Returns:

  • (Pathname)

    the configured path. (default: ‘Rails.root.join(’db’, ‘migrate’)‘)



594
# File 'lib/spree/app_configuration.rb', line 594

attr_writer :migration_path

#order_bill_address_usedBoolean

bill addresses on payment sources. (default: true)

Returns:

  • (Boolean)

    Use the order’s bill address, as opposed to storing



197
# File 'lib/spree/app_configuration.rb', line 197

preference :order_bill_address_used, :boolean, default: true

#order_cancellations_classClass

Allows providing your own class for managing the inventory units of a completed order.

Returns:

  • (Class)

    a class with the same public interfaces as Spree::OrderCancellations.



446
# File 'lib/spree/app_configuration.rb', line 446

class_name_attribute :order_cancellations_class, default: 'Spree::OrderCancellations'

#order_capturing_time_windowInteger

Returns the number of days to look back for fully-shipped/cancelled orders in order to charge for them.

Returns:

  • (Integer)

    the number of days to look back for fully-shipped/cancelled orders in order to charge for them



201
# File 'lib/spree/app_configuration.rb', line 201

preference :order_capturing_time_window, :integer, default: 14

#order_contents_classClass

Allows providing your own class for managing the contents of an order.

Returns:

  • (Class)

    a class with the same public interfaces as Spree::OrderContents.



431
# File 'lib/spree/app_configuration.rb', line 431

class_name_attribute :order_contents_class, default: 'Spree::OrderContents'

#order_mailer_classActionMailer::Base

Allows providing your own Mailer for order mailer.

Returns:

  • (ActionMailer::Base)

    an object that responds to “confirm_email”, “cancel_email” and “inventory_cancellation_email” (e.g. an ActionMailer with a “confirm_email” method) with the same signature as Spree::OrderMailer.confirm_email.



353
# File 'lib/spree/app_configuration.rb', line 353

class_name_attribute :order_mailer_class, default: 'Spree::OrderMailer'

#order_merger_classClass

Allows providing your own class for merging two orders.

Returns:

  • (Class)

    a class with the same public interfaces as Spree::OrderMerger.



416
# File 'lib/spree/app_configuration.rb', line 416

class_name_attribute :order_merger_class, default: 'Spree::OrderMerger'

#order_mutex_max_ageInteger

Returns Max age of OrderMutex in seconds (default: 2 minutes).

Returns:

  • (Integer)

    Max age of OrderMutex in seconds (default: 2 minutes)



205
# File 'lib/spree/app_configuration.rb', line 205

preference :order_mutex_max_age, :integer, default: 120

#order_number_generatorClass

Allows providing your own class instance for generating order numbers.

Returns:

  • (Class)

    a class instance with the same public interfaces as Spree::Order::NumberGenerator



605
# File 'lib/spree/app_configuration.rb', line 605

attr_writer :order_number_generator

#order_recalculator_classClass

Allows providing a different order recalculator.

Returns:

  • (Class)

    an object that conforms to the API of the standard order recalculator class Spree::OrderUpdater.

See Also:



368
# File 'lib/spree/app_configuration.rb', line 368

class_name_attribute :order_recalculator_class, default: 'Spree::OrderUpdater'

#order_shipping_classClass

Allows providing your own class for shipping an order.

Returns:

  • (Class)

    a class with the same public interfaces as Spree::OrderShipping.



438
# File 'lib/spree/app_configuration.rb', line 438

class_name_attribute :order_shipping_class, default: 'Spree::OrderShipping'

#order_update_attributes_classClass

Allows providing your own order update attributes class for checkout.

Returns:

  • (Class)

    a class that responds to “call” with the same signature as Spree::OrderUpdateAttributes.



360
# File 'lib/spree/app_configuration.rb', line 360

class_name_attribute :order_update_attributes_class, default: 'Spree::OrderUpdateAttributes'

#orders_per_pageInteger

Returns Orders to show per-page in the admin (default: 15).

Returns:

  • (Integer)

    Orders to show per-page in the admin (default: 15)



209
# File 'lib/spree/app_configuration.rb', line 209

preference :orders_per_page, :integer, default: 15

#payment_cancellerClass

Allows providing your own class for canceling payments.

Returns:

  • (Class)

    a class instance that responds to ‘cancel!(payment)`



452
# File 'lib/spree/app_configuration.rb', line 452

attr_writer :payment_canceller

Allows providing your own class for image galleries on Products

Enumerable of images adhering to the present_image_class interface

Returns:

  • (Class)

    a class that implements an ‘images` method and returns an



509
# File 'lib/spree/app_configuration.rb', line 509

class_name_attribute :product_gallery_class, default: 'Spree::Gallery::ProductGallery'

#product_image_style_defaultSymbol

Defines which style to default to when style is not provided :product is the default.

Returns:

  • (Symbol)


535
# File 'lib/spree/app_configuration.rb', line 535

class_name_attribute :product_image_style_default, default: :product

#product_image_stylesHash

Defines image styles/sizes hash for styles ‘{ mini: ’48x48>‘,

small: '400x400>',
product: '680x680>',
large: '1200x1200>' } is the default.

Returns:

  • (Hash)


546
547
548
549
# File 'lib/spree/app_configuration.rb', line 546

class_name_attribute :product_image_styles, default: { mini: '48x48>',
small: '400x400>',
product: '680x680>',
large: '1200x1200>' }

#products_per_pageInteger

Returns Products to show per-page in the frontend (default: 12).

Returns:

  • (Integer)

    Products to show per-page in the frontend (default: 12)



217
# File 'lib/spree/app_configuration.rb', line 217

preference :products_per_page, :integer, default: 12

#promotion_code_batch_mailer_classActionMailer::Base

Allows providing your own Mailer for promotion code batch mailer.

Returns:

  • (ActionMailer::Base)

    an object that responds to “promotion_code_batch_finished”, and “promotion_code_batch_errored” (e.g. an ActionMailer with a “promotion_code_batch_finished” method) with the same signature as Spree::PromotionCodeBatchMailer.promotion_code_batch_finished.



393
# File 'lib/spree/app_configuration.rb', line 393

class_name_attribute :promotion_code_batch_mailer_class, default: 'Spree::PromotionCodeBatchMailer'

#promotions_per_pageInteger

Returns Promotions to show per-page in the admin (default: 15).

Returns:

  • (Integer)

    Promotions to show per-page in the admin (default: 15)



221
# File 'lib/spree/app_configuration.rb', line 221

preference :promotions_per_page, :integer, default: 15

#properties_per_pageInteger

Returns Properties to show per-page in the admin (default: 15).

Returns:

  • (Integer)

    Properties to show per-page in the admin (default: 15)



213
# File 'lib/spree/app_configuration.rb', line 213

preference :properties_per_page, :integer, default: 15

#reimbursement_mailer_classActionMailer::Base

Allows providing your own Mailer for reimbursement mailer.

Returns:

  • (ActionMailer::Base)

    an object that responds to “reimbursement_email” (e.g. an ActionMailer with a “reimbursement_email” method) with the same signature as Spree::ReimbursementMailer.reimbursement_email.



401
# File 'lib/spree/app_configuration.rb', line 401

class_name_attribute :reimbursement_mailer_class, default: 'Spree::ReimbursementMailer'

#require_master_priceBoolean

Returns Require a price on the master variant of a product (default: true).

Returns:

  • (Boolean)

    Require a price on the master variant of a product (default: true)



225
# File 'lib/spree/app_configuration.rb', line 225

preference :require_master_price, :boolean, default: true

#require_payment_to_shipBoolean

Returns Allows shipments to be ready to ship regardless of the order being paid if false (default: true).

Returns:

  • (Boolean)

    Allows shipments to be ready to ship regardless of the order being paid if false (default: true)



229
# File 'lib/spree/app_configuration.rb', line 229

preference :require_payment_to_ship, :boolean, default: true

#return_eligibility_number_of_daysInteger

Returns default: 365.

Returns:

  • (Integer)

    default: 365



233
# File 'lib/spree/app_configuration.rb', line 233

preference :return_eligibility_number_of_days, :integer, default: 365

#roles_for_auto_api_keyArray

at role_user creation is desired when user has one of these roles. (default: [‘admin’])

Returns:

  • (Array)

    An array of roles where generating an api key for a user



239
# File 'lib/spree/app_configuration.rb', line 239

preference :roles_for_auto_api_key, :array, default: ['admin']

#send_core_emailsBoolean

Returns Whether to send transactional emails (default: true).

Returns:

  • (Boolean)

    Whether to send transactional emails (default: true)



251
# File 'lib/spree/app_configuration.rb', line 251

preference :send_core_emails, :boolean, default: true

#shipping_instructionsBoolean

Returns Request instructions/info for shipping (default: false).

Returns:

  • (Boolean)

    Request instructions/info for shipping (default: false)



255
# File 'lib/spree/app_configuration.rb', line 255

preference :shipping_instructions, :boolean, default: false

#shipping_promotion_handler_classClass

Allows providing a different shipping promotion handler.

Returns:

  • (Class)

    an object that conforms to the API of the standard shipping promotion handler class Spree::PromotionHandler::Coupon.

See Also:



384
# File 'lib/spree/app_configuration.rb', line 384

class_name_attribute :shipping_promotion_handler_class, default: 'Spree::PromotionHandler::Shipping'

#shipping_rate_tax_calculator_classClass

Allows providing your own class for calculating taxes on a shipping rate.

Returns:

  • (Class)

    a class with the same public interfaces as Spree::TaxCalculator::ShippingRate



344
# File 'lib/spree/app_configuration.rb', line 344

class_name_attribute :shipping_rate_tax_calculator_class, default: 'Spree::TaxCalculator::ShippingRate'

#show_only_complete_orders_by_defaultBoolean

Returns Only show completed orders by default in the admin (default: true).

Returns:

  • (Boolean)

    Only show completed orders by default in the admin (default: true)



259
# File 'lib/spree/app_configuration.rb', line 259

preference :show_only_complete_orders_by_default, :boolean, default: true

#show_products_without_priceBoolean

Returns Whether products without a price are visible in the frontend (default: false).

Returns:

  • (Boolean)

    Whether products without a price are visible in the frontend (default: false)



267
# File 'lib/spree/app_configuration.rb', line 267

preference :show_products_without_price, :boolean, default: false

#show_raw_product_descriptionBoolean

Returns Don’t escape HTML of product descriptions. (default: false).

Returns:

  • (Boolean)

    Don’t escape HTML of product descriptions. (default: false)



271
# File 'lib/spree/app_configuration.rb', line 271

preference :show_raw_product_description, :boolean, default: false

#show_variant_full_priceBoolean

Returns Displays variant full price or difference with product price. (default: false).

Returns:

  • (Boolean)

    Displays variant full price or difference with product price. (default: false)



263
# File 'lib/spree/app_configuration.rb', line 263

preference :show_variant_full_price, :boolean, default: false

#store_credit_prioritizer_classClass

Allows providing your own class for prioritizing store credit application to an order.

Returns:

  • (Class)

    a class with the same public interfaces as Spree::StoreCreditPrioritizer.



557
# File 'lib/spree/app_configuration.rb', line 557

class_name_attribute :store_credit_prioritizer_class, default: 'Spree::StoreCreditPrioritizer'

#tax_adjuster_classClass

Allows providing your own class for calculating taxes on an order.

This extension point is under development and may change in a future minor release.

Returns:

  • (Class)

    a class with the same public interfaces as Spree::Tax::OrderAdjuster



474
# File 'lib/spree/app_configuration.rb', line 474

class_name_attribute :tax_adjuster_class, default: 'Spree::Tax::OrderAdjuster'

#tax_calculator_classClass

Allows providing your own class for calculating taxes on an order.

Returns:

  • (Class)

    a class with the same public interfaces as Spree::TaxCalculator::Default



481
# File 'lib/spree/app_configuration.rb', line 481

class_name_attribute :tax_calculator_class, default: 'Spree::TaxCalculator::Default'

#tax_using_ship_addressBoolean

Returns Use the shipping address rather than the billing address to determine tax (default: true).

Returns:

  • (Boolean)

    Use the shipping address rather than the billing address to determine tax (default: true)



275
# File 'lib/spree/app_configuration.rb', line 275

preference :tax_using_ship_address, :boolean, default: true

#taxon_attachment_moduleModule

Allows switching attachment library for Taxon

‘Spree::Taxon::ActiveStorageAttachment` is the default and provides the Active Storage implementation.

Enumerable of taxons adhering to the present_taxon_class interface

Returns:

  • (Module)

    a module that can be included into Spree::Taxon to allow attachments



586
# File 'lib/spree/app_configuration.rb', line 586

class_name_attribute :taxon_attachment_module, default: "Spree::Taxon::ActiveStorageAttachment"

#taxon_image_style_defaultSymbol

Defines which style to default to when style is not provided :mini is the default.

Returns:

  • (Symbol)


565
# File 'lib/spree/app_configuration.rb', line 565

class_name_attribute :taxon_image_style_default, default: :mini

#taxon_stylesHash

Defines taxon styles/sizes hash for styles ‘{ mini: ’48x48>‘,

small: '400x400>',
product: '680x680>',
large: '1200x1200>' } is the default.

Returns:

  • (Hash)


576
# File 'lib/spree/app_configuration.rb', line 576

class_name_attribute :taxon_image_styles, default: { mini: '32x32>', normal: '128x128>' }

#taxon_url_parametizer_classClass

Allows providing your own class for creating urls on taxons

returns a String

Returns:

  • (Class)

    a class that provides a ‘#parameterize` method that



495
# File 'lib/spree/app_configuration.rb', line 495

class_name_attribute :taxon_url_parametizer_class, default: 'ActiveSupport::Inflector'

#track_inventory_levelsObject

Determines whether to track on_hand values for variants / products. If you do not track inventory, or have effectively unlimited inventory for all products you can turn this on.

Returns:

  • Track on_hand values for variants / products. (default: true)



282
# File 'lib/spree/app_configuration.rb', line 282

preference :track_inventory_levels, :boolean, default: true

Allows providing your own class for image galleries on Variants

Enumerable of images adhering to the present_image_class interface

Returns:

  • (Class)

    a class that implements an ‘images` method and returns an



502
# File 'lib/spree/app_configuration.rb', line 502

class_name_attribute :variant_gallery_class, default: 'Spree::Gallery::VariantGallery'

#variant_price_selector_classClass

Allows implementing custom pricing for variants

Returns:

  • (Class)

    an object that conforms to the API of the standard variant price selector class Spree::Variant::PriceSelector.

See Also:



303
# File 'lib/spree/app_configuration.rb', line 303

class_name_attribute :variant_price_selector_class, default: 'Spree::Variant::PriceSelector'

#variant_vat_prices_generator_classClass

Allows implementing custom vat prices generation

Returns:

  • (Class)

    an object that conforms to the API of the standard variant vat prices generator class Spree::Variant::VatPriceGenerator.

See Also:



325
# File 'lib/spree/app_configuration.rb', line 325

class_name_attribute :variant_vat_prices_generator_class, default: 'Spree::Variant::VatPriceGenerator'

Instance Method Details

#admin_vat_locationSpree::Tax::TaxLocation

Default admin VAT location

An object that responds to :state_id and :country_id so it can double as a Spree::Address in Spree::Zone.for_address. Takes the ‘admin_vat_country_iso` as input.

Returns:

See Also:



719
720
721
722
723
# File 'lib/spree/app_configuration.rb', line 719

def admin_vat_location
  @default_tax_location ||= Spree::Tax::TaxLocation.new(
    country: Spree::Country.find_by(iso: admin_vat_country_iso)
  )
end

#default_pricing_optionsvariant_price_selector_class

Shortcut for the default pricing options

Returns:



313
314
315
# File 'lib/spree/app_configuration.rb', line 313

def default_pricing_options
  pricing_options_class.new
end

#environmentObject



635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
# File 'lib/spree/app_configuration.rb', line 635

def environment
  @environment ||= Spree::Core::Environment.new(self).tap do |env|
    env.calculators.promotion_actions_create_adjustments = %w[
      Spree::Calculator::FlatPercentItemTotal
      Spree::Calculator::FlatRate
      Spree::Calculator::FlexiRate
      Spree::Calculator::TieredPercent
      Spree::Calculator::TieredFlatRate
    ]

    env.calculators.promotion_actions_create_item_adjustments = %w[
      Spree::Calculator::DistributedAmount
      Spree::Calculator::FlatRate
      Spree::Calculator::FlexiRate
      Spree::Calculator::PercentOnLineItem
      Spree::Calculator::TieredPercent
    ]

    env.calculators.promotion_actions_create_quantity_adjustments = %w[
      Spree::Calculator::PercentOnLineItem
      Spree::Calculator::FlatRate
    ]

    env.calculators.shipping_methods = %w[
      Spree::Calculator::Shipping::FlatPercentItemTotal
      Spree::Calculator::Shipping::FlatRate
      Spree::Calculator::Shipping::FlexiRate
      Spree::Calculator::Shipping::PerItem
      Spree::Calculator::Shipping::PriceSack
    ]

    env.calculators.tax_rates = %w[
      Spree::Calculator::DefaultTax
      Spree::Calculator::FlatFee
    ]

    env.payment_methods = %w[
      Spree::PaymentMethod::BogusCreditCard
      Spree::PaymentMethod::SimpleBogusCreditCard
      Spree::PaymentMethod::StoreCredit
      Spree::PaymentMethod::Check
    ]

    env.promotions.rules = %w[
      Spree::Promotion::Rules::ItemTotal
      Spree::Promotion::Rules::Product
      Spree::Promotion::Rules::User
      Spree::Promotion::Rules::FirstOrder
      Spree::Promotion::Rules::UserLoggedIn
      Spree::Promotion::Rules::OneUsePerUser
      Spree::Promotion::Rules::Taxon
      Spree::Promotion::Rules::MinimumQuantity
      Spree::Promotion::Rules::NthOrder
      Spree::Promotion::Rules::OptionValue
      Spree::Promotion::Rules::FirstRepeatPurchaseSince
      Spree::Promotion::Rules::UserRole
      Spree::Promotion::Rules::Store
    ]

    env.promotions.actions = %w[
      Spree::Promotion::Actions::CreateAdjustment
      Spree::Promotion::Actions::CreateItemAdjustments
      Spree::Promotion::Actions::CreateQuantityAdjustments
      Spree::Promotion::Actions::FreeShipping
    ]

    env.promotions.shipping_actions = %w[
      Spree::Promotion::Actions::FreeShipping
    ]

    env.stock_splitters = %w[
      Spree::Stock::Splitter::ShippingCategory
      Spree::Stock::Splitter::Backordered
    ]
  end
end

#pricing_options_classClass

Shortcut for getting the variant price selector’s pricing options class

Returns:

  • (Class)

    The pricing options class to be used



308
# File 'lib/spree/app_configuration.rb', line 308

delegate :pricing_options_class, to: :variant_price_selector_class

#rolesObject



622
623
624
625
626
627
# File 'lib/spree/app_configuration.rb', line 622

def roles
  @roles ||= Spree::RoleConfiguration.new.tap do |roles|
    roles.assign_permissions :default, ['Spree::PermissionSets::DefaultCustomer']
    roles.assign_permissions :admin, ['Spree::PermissionSets::SuperUser']
  end
end

#state_machinesObject



610
611
612
# File 'lib/spree/app_configuration.rb', line 610

def state_machines
  @state_machines ||= Spree::Core::StateMachines.new
end

#static_model_preferencesObject



614
615
616
# File 'lib/spree/app_configuration.rb', line 614

def static_model_preferences
  @static_model_preferences ||= Spree::Preferences::StaticModelPreferences.new
end

#stockObject



618
619
620
# File 'lib/spree/app_configuration.rb', line 618

def stock
  @stock_configuration ||= Spree::Core::StockConfiguration.new
end

#user_last_url_storer_rulesObject



629
630
631
632
633
# File 'lib/spree/app_configuration.rb', line 629

def user_last_url_storer_rules
  @user_last_url_storer_rules ||= ::Spree::Core::ClassConstantizer::Set.new.tap do |set|
    set << 'Spree::UserLastUrlStorer::Rules::AuthenticationRule'
  end
end